Aspose.PSD for .NET 24.6 - Release Notes
Contents
[
Hide
]
This page contains release notes forĀ Aspose.PSD for .NET 24.6
Key | Summary | Category |
---|---|---|
PSDNET-1450 | Implement support of Gradient map layer | Feature |
PSDNET-1670 | [AI Format] Add support of XPacket Metadata to AI Format | Feature |
PSDNET-1831 | Implement Inflate, Squeeze, and Twist types of warp | Feature |
PSDNET-1653 | Rgb and Lab modes can not contain less than 3 channels and more than 4 channels in the file with ArtBoard Layers | Bug |
PSDNET-1775 | The processing area top must be positive. (Parameter ‘areaToProcess’) on the processing of specific file | Bug |
PSDNET-2052 | Expanded over the canvas image is cropped after the saving. Data is lost but Preview looks correct | Bug |
Public API Changes
Added APIs:
- P:Aspose.PSD.FileFormats.Psd.Layers.FillSettings.NoiseGradientFillSettings.ExpansionCount
- M:Aspose.PSD.FileFormats.Psd.PsdImage.AddGradientMapAdjustmentLayer
- T:Aspose.PSD.FileFormats.Psd.Layers.AdjustmentLayers.GradientMapLayer
- P:Aspose.PSD.FileFormats.Psd.Layers.AdjustmentLayers.GradientMapLayer.GradientSettings
- P:Aspose.PSD.FileFormats.Ai.AiImage.XmpData
Removed APIs:
- None
Usage examples:
PSDNET-1450. Implement support of Gradient map layer
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.");
}
}
PSDNET-1670. [AI Format] Add support of XPacket Metadata to AI Format
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);
}
PSDNET-1831. Implement Inflate, Squeeze, and Twist types of warp
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
});
}
}
PSDNET-1653. Rgb and Lab modes can not contain less than 3 channels and more than 4 channels in the file with ArtBoard Layers
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);
}
PSDNET-1775. The processing area top must be positive. (Parameter ‘areaToProcess’) on the processing of specific file
string sourceFile = @"BANNERS_2_Intel-Gamer_psak.psd";
string outputFile = @"BANNERS_2_Intel-Gamer_psak_out.psd";
PsdLoadOptions psdLoadOptions = new PsdLoadOptions();
psdLoadOptions.LoadEffectsResource = true;
psdLoadOptions.AllowWarpRepaint = true;
using (PsdImage image = (PsdImage)PsdImage.Load(sourceFile, psdLoadOptions))
{
image.Save(outputFile);
// Shouldn't be exception
}
PSDNET-2052. Expanded over the canvas image is cropped after the saving. Data is lost but Preview looks correct
string sourceFile = Path.Combine(baseFolder, "bigfile.psd");
string outputFile = Path.Combine(outputFolder, "bigfile_output.psd");
string outputPicture = Path.Combine(outputFolder, "bigfile.png");
PsdLoadOptions loadOptions = new PsdLoadOptions()
{
LoadEffectsResource = true,
UseDiskForLoadEffectsResource = true
};
using (var psdImage = (PsdImage)Image.Load(sourceFile, loadOptions))
{
// There should no error here
psdImage.Save(outputFile, new PsdOptions { CompressionMethod = CompressionMethod.RLE });
}
using (var psdImage = (PsdImage)Image.Load(outputFile, loadOptions))
{
psdImage.Resize(psdImage.Width / 10, psdImage.Height / 10);
// There should no error here
psdImage.Save(outputPicture, new PngOptions { ColorType = PngColorType.TruecolorWithAlpha });
}