Aspose.PSD for .NET 19.12 - Release Notes
Contents
[
Hide
]
This page contains release notes for Aspose.PSD for .NET 19.12
**
Key | Summary | Category |
---|---|---|
PSDNET-11 | Support of Linked Layer | Feature |
PSDNET-131 | Support of SoCoResource | Feature |
PSDNET-115 | LineBreaks are added to existing LineBreaks if TextLayer is updated with a string | Bug |
PSDNET-157 | Saving PSB as PNG freezing | Bug |
PSDNET-250 | Exception on loading CMYK PSD file without layers with RLE compression | Bug |
PSDNET-161 | Exception on updating text layers | Bug |
PSDNET-222 | Resize some PSD files with layer masks works incorrect | Bug |
PSDNET-244 | Saving PSD with some Globalization.CultureInfo.CurrentCulture leads to exceptions on loading | Bug |
Public API Changes
Added APIs:
- P:Aspose.PSD.FileFormats.Psd.PsdImage.LinkedLayersManager
- P:Aspose.PSD.FileFormats.Psd.Layers.LayerMaskDataFull.UserMaskData
- T:Aspose.PSD.FileFormats.Psd.Layers.LinkedLayersManager
- M:Aspose.PSD.FileFormats.Psd.Layers.LinkedLayersManager.LinkLayers(Aspose.PSD.FileFormats.Psd.Layers.Layer[])
- M:Aspose.PSD.FileFormats.Psd.Layers.LinkedLayersManager.UnlinkLayer(Aspose.PSD.FileFormats.Psd.Layers.Layer)
- M:Aspose.PSD.FileFormats.Psd.Layers.LinkedLayersManager.GetLayersByLinkGroupId(System.Int16)
- M:Aspose.PSD.FileFormats.Psd.Layers.LinkedLayersManager.GetLinkGroupId(Aspose.PSD.FileFormats.Psd.Layers.Layer)
Removed APIs:
- P:Aspose.PSD.FileFormats.Psd.Layers.LayerMaskData.ImageDataVector
Usage examples:
PSDNET-11. Support of Linked Layer
using (var psd = (PsdImage)Image.Load("example.psd"))
{
Layer[] layers = psd.Layers;
// link all layers in one linked group
short layersLinkGroupId = psd.LinkedLayersManager.LinkLayers(layers);
// gets id for one layer
short linkGroupId = psd.LinkedLayersManager.GetLinkGroupId(layers[0]);
if (layersLinkGroupId != linkGroupId)
{
throw new Exception("layersLinkGroupId and linkGroupId are not equal.");
}
// gets all linked layers by link group id.
Layer[] linkedLayers = psd.LinkedLayersManager.GetLayersByLinkGroupId(linkGroupId);
// unlink each layer from group
foreach (var linkedLayer in linkedLayers)
{
psd.LinkedLayersManager.UnlinkLayer(linkedLayer);
}
// retrieves NULL for a link group ID that has no layers in the group.
linkedLayers = psd.LinkedLayersManager.GetLayersByLinkGroupId(linkGroupId);
if (linkedLayers != null)
{
throw new Exception("The linkedLayers field is not NULL.");
}
psd.Save("psdnet11_output.psd");
}
PSDNET-131. Support of SoCoResource
// Support of SoCoResource
string sourceFileName = "ColorFillLayer.psd";
string exportPath = "SoCoResource_Edited.psd";
var im = (PsdImage)Image.Load(sourceFileName);
using (im)
{
foreach (var layer in im.Layers)
{
if (layer is FillLayer)
{
var fillLayer = (FillLayer)layer;
foreach (var resource in fillLayer.Resources)
{
if (resource is SoCoResource)
{
var socoResource = (SoCoResource)resource;
Assert.AreEqual(Color.FromArgb(63, 83, 141), socoResource.Color);
socoResource.Color = Color.Red;
break;
}
}
break;
}
im.Save(exportPath);
}
}
PSDNET-115. LineBreaks are added to existing LineBreaks if TextLayer is updated with a string
const string NewText = "abcdef\rzxcvbn";
string sourceFilePath = "TestFileForAsianChars.psd");
string outputFilePath = "result.psd";
using (var image = (PsdImage)Image.Load(sourceFilePath))
{
var layer = (TextLayer)image.Layers[0];
var imageOptions = new PsdOptions(image);
layer.UpdateText(NewText);
image.Save(outputFilePath, imageOptions);
}
using (var createdImage = (PsdImage)Image.Load(outputFilePath))
{
var createdLayer = (TextLayer)createdImage.Layers[0];
if (NewText != createdLayer.Text)
{
throw new InvalidDataException("Updated text is invalid");
}
}
PSDNET-157. Saving PSB as PNG freezing
// Saving PSB as PNG
string sourceFileName = "sample.psb";
string outFileName = "sample.png";
using (PsdImage image = (PsdImage)Image.Load(sourceFileName))
{
PngOptions options = new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha };
image.Save(outFileName, options);
}
PSDNET-250. Exception on loading CMYK PSD file without layer with RLE compression
void LoadRawDataFromPsd()
{
string sourcePath = "CmykWithAlpha.psd";
using (RasterImage image = (RasterImage)Image.Load(sourcePath))
{
var rawDataSettings = image.RawDataSettings;
RawDataTester loader = new RawDataTester();
image.LoadRawData(image.Bounds, rawDataSettings, loader);
}
}
class RawDataTester : IPartialRawDataLoader
{
public void Process(Rectangle rectangle, byte[] pixels, Point start, Point end)
{
}
public void Process(Rectangle rectangle, byte[] pixels, Point start, Point end, LoadOptions loadOptions)
{
}
}
PSDNET-161. Exception on updating text layers
// Load a PSD file as an image and cast it into PsdImage
using (PsdImage psdImage = (PsdImage)Image.Load("example.psd"))
{
foreach (var layer in psdImage.Layers)
{
if (layer is TextLayer)
{
TextLayer textLayer = layer as TextLayer;
textLayer.UpdateText("test update", new Point(0, 0), 15.0f, Color.Purple);
}
}
psdImage.Save("UpdateTextLayerInPSDFile_out.psd");
}
PSDNET-222. Resize some PSD files with layer masks works incorrect
int scale = 2;
string[] names = {
"OneRegularAndOneAdjustmentWithVectorAndLayerMask",
"LevelsLayerWithLayerMaskRgb",
"LevelsLayerWithLayerMaskCmyk",
"ColorBalanceAdjustmentLayer"
};
for (int i = 0; i < names.Length; i++)
{
string sourceFilePath = names[i] + ".psd";
string outputFilePath = "output_" + sourceFilePath;
string outputPngFilePath = "output_" + names[i] + ".png";
var psdLoadOptions = new PsdLoadOptions() { LoadEffectsResource = true };
using (PsdImage image = (PsdImage)Image.Load(sourceFilePath, psdLoadOptions))
{
image.Resize(image.Width * scale, image.Height * scale);
image.Save(outputFilePath, new PsdOptions());
image.Save(outputPngFilePath, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}
}
PSDNET-244. Saving PSD with some Globalization.CultureInfo.CurrentCulture leads to exceptions on loading
for (int i = 0; i <= 6; i++)
{
string sourceFileName = string.Format("example-{0}.psd", i);
var psdLoadOptions = new PsdLoadOptions() { LoadEffectsResource = true };
var psdSaveOptions = new PsdOptions();
var culture = new System.Globalization.CultureInfo("ru-RU");
System.Threading.Thread.CurrentThread.CurrentCulture = culture;
System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
string outputFileName = "output-" + sourceFileName;
// Load a PSD file as an image and cast it into PsdImage
using (PsdImage image = (PsdImage)Image.Load(sourceFileName, psdLoadOptions))
{
image.Resize(160, 120);
image.Save(outputFileName, psdSaveOptions);
}
culture = new System.Globalization.CultureInfo("en-US");
System.Threading.Thread.CurrentThread.CurrentCulture = culture;
System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
// Load a PSD file as an image and cast it into PsdImage
using (PsdImage image2 = (PsdImage)Image.Load(sourceFileName, psdLoadOptions))
{
image2.Resize(160, 120);
image2.Save(outputFileName, psdSaveOptions);
}
}