Scrapbook 0.6.0
dotnet add package Scrapbook --version 0.6.0
NuGet\Install-Package Scrapbook -Version 0.6.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Scrapbook" Version="0.6.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Scrapbook" Version="0.6.0" />
<PackageReference Include="Scrapbook" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Scrapbook --version 0.6.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Scrapbook, 0.6.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Scrapbook@0.6.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Scrapbook&version=0.6.0
#tool nuget:?package=Scrapbook&version=0.6.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Scrapbook
A DSL-based image processing library for .NET. Write simple scripts to create, compose, crop, fill, flip, paste, resize, rotate, and reverse images using a readable scripting language.
Installation
dotnet add package Scrapbook
Usage
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using Scrapbook;
// Load input images
using var source1 = await Image.LoadAsync<Rgba32>("photo1.png");
using var source1 = await Image.LoadAsync<Rgba32>("photo2.png");
var parser = new ScrapbookParser();
// Call the parser to execute a script, providing the input images that can be referenced in the script
var outputs = parser.Parse("""
# Assign input images to variables
source1 = input 0
source2 = input 1
# Flip the first image horizontally and add it to the output
flipped = flip source1 horizontal
output flipped
# Copy a portion of the second image, rotate it, and add it to the output
portion = copy source2 50,50 100,100
rotatedPortion = rotate portion 90
output rotatedPortion
""", new[] { source1, source2 });
// Save the output images
await outputs[0].SaveAsync("result1.png");
await outputs[1].SaveAsync("result2.png");
Script Commands
| Command | Syntax | Description |
|---|---|---|
create |
var = create <w,h> [color] |
Creates a new image with optional background color |
input |
var = input <index> |
Loads an input image by index |
output |
output <var> |
Adds an image to the output list |
copy |
var = copy <source> <x,y> <w,h> |
Copies a rectangular region from an image |
fill |
var = fill <source> <x,y> <w,h> <color> |
Fills a rectangular region of an image with a color |
flip |
var = flip <source> horizontal\|vertical |
Flips an image along an axis |
paste |
var = paste <source> <target> <x,y> |
Pastes one image onto another at the given position |
rotate |
var = rotate <source> <degrees> |
Rotates an image by the given number of degrees |
reverse |
var = reverse <source> |
Inverts the colours of an image |
resize |
var = resize <source> <w,h> |
Resizes an image to the given dimensions |
Requirements
- .NET 10 or later
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Irony (>= 1.5.3)
- SixLabors.ImageSharp (>= 3.1.12)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.