Aspose.PSD Adapters for .NET QuickStart Guide
Simple using
Aspose.PSD Adapters for .NET are the special Nuget Packages that allows you to write integration code with other Aspose Products less.
To start using Aspose.PSD Adapters please check the following instruction:
- Reference Aspose.PSD.Adapters.Imaging from Nuget or download them from Aspose Release Page(Adapters are included in the main release artifact at this moment) to your project
- Please note: If you using the Aspose.PSD.Adapters from the https://releases.aspose.com/psd/net/ you need additionally to reference Aspose.Drawing and Aspose.Imaging from nuget or the local files.
- Add to the the following code:
// This code allows to load the specified formats | |
Aspose.PSD.Adapters.Imaging.EnableLoaders( | |
FileFormat.Svg, | |
FileFormat.Webp); | |
// This code allows you to export using adapters | |
Aspose.PSD.Adapters.Imaging.EnableExporters(); | |
// To work with adapters you need both Aspose.PSD and adaptee Licenses | |
var license = new Aspose.PSD.License(); | |
license.SetLicense(@"Aspose.PSD.NET.lic"); | |
var licImaging = new Aspose.Imaging.License(); | |
licImaging.SetLicense(@"Aspose.Imaging.NET.lic"); | |
// Aspose.Imaging loading and integration with PSD format will be provided seamless in this case. | |
using (var image = Image.Load(@"SomeFile.Webp")) | |
{ | |
// Saving in this example is provided by Aspose.PSD | |
image.Save(@"output.png", new PngOptions() { ColorType = Aspose.PSD.FileFormats.Png.PngColorType.TruecolorWithAlpha }); | |
} |
- That’s all you need to use adapters
Export and Loading with additional Adaptee-specific options
In most cases that’s enough to use first example, but in the complex solutions sometimes is needed to make conversions with additional options. Please check the following example:
// Create new Imaging-only supported Image (Can be used SVG, or any other not-supported in PSD Format) | |
using (WebPImage webp = new WebPImage(300, 300, null)) | |
{ | |
// Use Aspose.Imaging API to Edit WEBP file with Imaging-specific features | |
var gr = new Aspose.Imaging.Graphics(webp); | |
gr.Clear(Aspose.Imaging.Color.Wheat); | |
gr.DrawArc( | |
new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 5), | |
new Aspose.Imaging.Rectangle(50, 50, 200, 200), | |
0, | |
270); | |
// Then just use ToPsdImage() method and edit file like PSD with Photoshop-like features including layers, smart filters and smart objects. | |
using (var psdImage = webp.ToPsdImage()) | |
{ | |
psdImage.AddTextLayer("Some text", new Rectangle(100, 100, 100, 50)); | |
var hue = psdImage.AddHueSaturationAdjustmentLayer(); | |
hue.Hue = 130; | |
// Save the final PSD file using Aspose.PSD | |
psdImage.Save("output.psd"); | |
} | |
} |
At this point you don’t need to write any additional code. Adapters provide seamless integration with full rich API of Aspose.PSD and its Adaptees