Aspose.PSD for .NET 24.6 (DLLs-only package) helps you integrate new features into your image processing applications and boosts their capabilities. This version delivers Gradient Map adjustments, XMP data access (for AI files), and support for Inflate, Squeeze, and Twist warp types.
Support for Gradient Map
Develop platform-independent PSD and API image manipulation apps with the capability to provide excellent visual effects. It is now possible with the gradient map support functionality in the latest release of the C# PSD library. This feature allows you to seamlessly create stunning color adjustments, as showcased in the following C# code example:
string sourceFile = Path.Combine(baseFolder, "gradient_map_src.psd");
string outputFile = Path.Combine(outputFolder, "gradient_map_src_output.psd");
using (PsdImage im = (PsdImage)Image.Load(sourceFile))
{
// Add Gradient map adjustment layer.
GradientMapLayer layer = im.AddGradientMapAdjustmentLayer();
layer.GradientSettings.Reverse = true;
im.Save(outputFile);
}
// Check saved changes
using (PsdImage im = (PsdImage)Image.Load(outputFile))
{
GradientMapLayer gradientMapLayer = im.Layers[1] as GradientMapLayer;
GradientFillSettings gradientSettings = (GradientFillSettings)gradientMapLayer.GradientSettings;
AssertAreEqual(0.0, gradientSettings.Angle);
AssertAreEqual((short)4096, gradientSettings.Interpolation);
AssertAreEqual(true, gradientSettings.Reverse);
AssertAreEqual(false, gradientSettings.AlignWithLayer);
AssertAreEqual(false, gradientSettings.Dither);
AssertAreEqual(GradientType.Linear, gradientSettings.GradientType);
AssertAreEqual(100, gradientSettings.Scale);
AssertAreEqual(0.0, gradientSettings.HorizontalOffset);
AssertAreEqual(0.0, gradientSettings.VerticalOffset);
AssertAreEqual("Custom", gradientSettings.GradientName);
}
void AssertAreEqual(object expected, object actual, string message = null)
{
if (!object.Equals(expected, actual))
{
throw new Exception(message ?? "Objects are not equal.");
}
}
Source*
Aspose.PSD for .NET 24.6 offers easy extraction of valuable XMP metadata from Adobe Illustrator (AI) files for extensive analysis of image files. This code example highlights how to perform the metadata extraction in C#:
string sourceFile = Path.Combine(baseFolder, "ai_one.ai");
void AssertAreEqual(object expected, object actual)
{
if (!object.Equals(expected, actual))
{
throw new Exception("Objects are not equal.");
}
}
void AssertIsNotNull(object testObject)
{
if (testObject == null)
{
throw new Exception("Test object are null.");
}
}
string creatorToolKey = ":CreatorTool";
string nPagesKey = "xmpTPg:NPages";
string unitKey = "stDim:unit";
string heightKey = "stDim:h";
string widthKey = "stDim:w";
string expectedCreatorTool = "Adobe Illustrator CC 22.1 (Windows)";
string expectedNPages = "1";
string expectedUnit = "Pixels";
double expectedHeight = 768;
double expectedWidth = 1366;
using (AiImage image = (AiImage)Image.Load(sourceFile))
{
// Xmp Metadata was added.
var xmpMetaData = image.XmpData;
AssertIsNotNull(xmpMetaData);
// No we can get access to Xmp Packages of AI files.
var basicPackage = xmpMetaData.GetPackage(Namespaces.XmpBasic) as XmpBasicPackage;
var package = xmpMetaData.Packages[4];
// And we have access to the content of these packages.
var creatorTool = basicPackage[creatorToolKey].ToString();
var nPages = package[nPagesKey];
var unit = package[unitKey];
var height = double.Parse(package[heightKey].ToString(), CultureInfo.InvariantCulture);
var width = double.Parse(package[widthKey].ToString(), CultureInfo.InvariantCulture);
AssertAreEqual(creatorTool, expectedCreatorTool);
AssertAreEqual(nPages, expectedNPages);
AssertAreEqual(unit, expectedUnit);
AssertAreEqual(height, expectedHeight);
AssertAreEqual(width, expectedWidth);
}
Source*
Creative Warp Effects
Enhance your creativity with the ability to distort images by adding Inflate, Squeeze, and Twist warp effects. Please check out this sample coding to learn how to use this feature:
string[] files = { "Twist", "Squeeze", "Squeeze_vert", "Inflate" };
foreach (string prefix in files)
{
string sourceFile = Path.Combine(baseFolder, prefix + ".psd");
string outputFile = Path.Combine(outputFolder, prefix + "_export.png");
using (var psdImage = (PsdImage)Image.Load(sourceFile, new PsdLoadOptions() { AllowWarpRepaint = true, LoadEffectsResource = true }))
{
psdImage.Save(outputFile, new PngOptions
{
ColorType = PngColorType.TruecolorWithAlpha
});
}
}
Source*
Version 24.6 of Aspose.PSD for .NET ascertains better handling of PSD files with RGB and Lab color modes having specific channel configurations and processing area top values. The following code example illustrates the feature usage in C#:
string sourceFile = Path.Combine(baseFolder, "Rgb5Channels.psb");
string outputFile = Path.Combine(outputFolder, "Rgb5Channels_output.psd");
using (PsdImage image = (PsdImage)Aspose.PSD.Image.Load(sourceFile))
{
// Here should be no exception
image.Save(outputFile);
}
Source*
Resolved Issues
The latest C# library release includes the fixes for issues causing data loss while saving expanded canvas images on a platform of your choice.
You can view the list of all new features, enhancements, and bug fixes introduced in this release by visiting Aspose.PSD for .NET 24.6 Release Notes.