RecursiveAI.OneImage.Psd
1.5.0
See the version list below for details.
dotnet add package RecursiveAI.OneImage.Psd --version 1.5.0
NuGet\Install-Package RecursiveAI.OneImage.Psd -Version 1.5.0
<PackageReference Include="RecursiveAI.OneImage.Psd" Version="1.5.0" />
<PackageVersion Include="RecursiveAI.OneImage.Psd" Version="1.5.0" />
<PackageReference Include="RecursiveAI.OneImage.Psd" />
paket add RecursiveAI.OneImage.Psd --version 1.5.0
#r "nuget: RecursiveAI.OneImage.Psd, 1.5.0"
#:package RecursiveAI.OneImage.Psd@1.5.0
#addin nuget:?package=RecursiveAI.OneImage.Psd&version=1.5.0
#tool nuget:?package=RecursiveAI.OneImage.Psd&version=1.5.0
OneImage.Psd
Photoshop PSD and PSB support for OneImage: read the merged composite as an image, or load the whole layer tree into a OneImage layered document, edit it and save it again. Pure C# with no dependency beyond OneImage and .NET.
dotnet add package RecursiveAI.OneImage.Psd
using OneImage;
using OneImage.Psd;
// The merged composite, like any other format (register the format first; it is not in the default configuration).
var load = new LoadOptions { Configuration = new ImageConfiguration().Add(PsdFormat.Instance) };
Image.Load("poster.psd", load).Resize(width: 800).Save("poster.webp");
// The layers.
using PsdFile file = PsdFile.Load("poster.psd");
foreach (var layer in file.Document.Root.Children)
Console.WriteLine($"{layer.Name} {layer.BlendMode} {file.GetInfo(layer).Kind}");
file.Document.Render().Save("flattened.png");
file.Save("edited.psd");
What is new in 1.5.0
- Posterize, curves and brightness/contrast layers use Photoshop's own formulas (brightness/contrast in the current mode is a fitted approximation). Against the stored composites of 19 sample files the median mean error went from 10.5 to 0.005 levels.
- Gradient and pattern fill layers (and shape layers filled with them) are drawn from their settings as fill layers;
PsdReadOptions.DrawFills = falsekeeps the stored pixels. 160 sample files are now fully modelled (median error 0.108 levels). - Layer effects (drop and inner shadows, outer and inner glows, solid strokes, color overlays, satin) are read into
Layer.Styleand drawn. The stroke sample files went from 15-40 levels of error to 0.00-0.16. - A hue/saturation adjustment with an out-of-range value is kept instead of failing to load.
Known limitations
- Saving after a layer style was edited or added throws
ImageOperationException. Writing layer styles from the model is not built yet. A style still unchanged from the file is written back byte for byte. - Saving after a gradient or pattern fill's brush was replaced throws
ImageOperationException(the new brush has no PSD equivalent here). Unchanged fills are written back from their original block. - Text, smart objects, vector strokes and the effects that are not drawn render from their stored pixels.
What is covered
- Refused: multichannel documents (a typed
ImageFormatException). Bitmap, gray, duotone, indexed, RGB, CMYK and Lab at 8, 16 and 32 bits load; CMYK and Lab are converted to RGB through the color engine. - Modelled and round-tripped: pixel layers with offsets, groups, blend modes, opacity, fill opacity, visibility, clipping, lock flags, raster and vector masks (a vector mask becomes a raster mask), solid color fills, gradient and pattern fills (drawn from their settings;
PsdReadOptions.DrawFills = falsekeeps the stored pixels), and the levels, curves, hue/saturation, brightness/contrast, exposure, invert, threshold and posterize adjustments. - Layer effects: drop and inner shadows, outer and inner glows, solid strokes, color overlays and satin are read into
Layer.Styleand drawn. Gradient and pattern overlays and strokes, gradient glows and bevel/emboss are not drawn (PsdLayerInfo.EffectsNotDrawn). The block is written back byte for byte; saving a changed style is not supported yet and throws. - Kept only as stored pixels plus untouched blocks: text, smart objects, vector strokes, the layer effects that are not drawn, and gradient or pattern fills outside the drawn subset. They render from the pixels Photoshop stored, are not redrawn, and their blocks are written back unchanged.
- Known gaps against Photoshop: posterize, curves and legacy brightness/contrast follow Photoshop (buckets, a natural cubic spline, the legacy formula), while brightness/contrast in Photoshop's current mode is a fitted approximation; hard mix and vivid light differ slightly; vector-mask path operations use the non-zero rule only; levels, curves, hue/saturation, brightness/contrast and exposure layers in CMYK and Lab documents are kept but not applied; dissolve and darker/lighter color render as Normal, Darken and Lighten.
The PSD page has the full mapping, the fidelity figures, the limits and the speed. Layered documents are described in the layers page.
License
Licensed under either of MIT or Apache-2.0 at your option.
Copyright (c) Recursive AI, LLC.
| 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. |
-
net10.0
- RecursiveAI.OneImage (= 1.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
See CHANGELOG.md in the repository.