Aspose.PSD for .NET 22.9 - Release Notes
Contents
 [
      
        Hide
      ]
    
This page contains release notes for Aspose.PSD for .NET 22.9
- This release has a regression in the case of 16-bit exports, so we recommend caution when using this feature in this release. Please do not update Aspose.PSD to 22.9 if 16-bit image processing is your primary functionality.
- For several versions of Photoshop, users may encounter a window with an error reading layer, this will not affect the work with the PSD file.
We are working on solutions to these problems.
| Key | Summary | Category | 
|---|---|---|
| PSDNET-1237 | Create the internal LayerStyleFX model that will contain effects and related data for using the single model in effects resources Lfx2, lmfx, and mlst | Enhancement | 
| PSDNET-1227 | Add reading and writing of ‘Lefx’ structures with effects information for layer states in TimeLine models | Feature | 
| PSDNET-1230 | Applying TimeLine layer state to layer in PsdImage | Feature | 
| PSDNET-1072 | Incorrect transparency on saving of PSD file (RGB/16bit) on export to 8bit | Bug | 
| PSDNET-1140 | Exception on loading global layer resources step when opening PSB document | Bug | 
| PSDNET-1266 | Memory leak on the processing of specific files | Bug | 
Public API Changes
Added APIs:
- P:Aspose.PSD.FileFormats.Psd.Layers.Animation.LayerState.PositionOffset
- P:Aspose.PSD.FileFormats.Psd.Layers.Animation.LayerState.StateEffects
- T:Aspose.PSD.FileFormats.Psd.Layers.Animation.LayerStateEffects
- P:Aspose.PSD.FileFormats.Psd.Layers.Animation.LayerStateEffects.IsVisible
- P:Aspose.PSD.FileFormats.Psd.Layers.Animation.LayerStateEffects.Effects
- M:Aspose.PSD.FileFormats.Psd.Layers.Animation.LayerStateEffects.AddDropShadow
- M:Aspose.PSD.FileFormats.Psd.Layers.Animation.LayerStateEffects.AddInnerShadow
- M:Aspose.PSD.FileFormats.Psd.Layers.Animation.LayerStateEffects.AddOuterGlow
- M:Aspose.PSD.FileFormats.Psd.Layers.Animation.LayerStateEffects.AddStroke(Aspose.PSD.FileFormats.Psd.Layers.FillSettings.FillType)
- M:Aspose.PSD.FileFormats.Psd.Layers.Animation.LayerStateEffects.AddColorOverlay
- M:Aspose.PSD.FileFormats.Psd.Layers.Animation.LayerStateEffects.AddGradientOverlay
- M:Aspose.PSD.FileFormats.Psd.Layers.Animation.LayerStateEffects.AddPatternOverlay
- M:Aspose.PSD.FileFormats.Psd.Layers.Animation.LayerStateEffects.ClearLayerStyle
- M:Aspose.PSD.FileFormats.Psd.Layers.Animation.LayerStateEffects.RemoveEffectAt(System.Int32)
Removed APIs:
- P:Aspose.PSD.FileFormats.Psd.Layers.Animation.LayerState.Offset
Usage examples:
PSDNET-1072. Incorrect transparency on saving of PSD file (RGB/16bit) on export to 8bit
string inputPsdFile    = "8bitWithTransparency.psd";
string outputPsdFile   = "16bitWithTransparency.psd";
string outputImageFile = "OutputWithTransparency.png";
using (var img = Image.Load(inputPsdFile))
{
    // 16 bit save options
    PsdOptions p16 = new PsdOptions() { ChannelBitsCount = 16, ColorMode = ColorModes.Rgb };
    img.Save(outputPsdFile, p16);
}
using (var img = Image.Load(outputPsdFile))
{
    // Save picture with 16 bit colors
    img.Save(outputImageFile, new PngOptions() { ColorType = Aspose.PSD.FileFormats.Png.PngColorType.TruecolorWithAlpha });
}
PSDNET-1140. Exception on loading global layer resources step when opening PSB document
string sourcePsdFile = "input.psb";
string outputImageFile = "output.png";
using (var image = (PsdImage)Image.Load(sourcePsdFile))
{
    // Here should be no exception.
    image.Save(outputImageFile, new PngOptions() { ColorType = PngColorType.GrayscaleWithAlpha });
}
PSDNET-1227. Add reading and writing of ‘Lefx’ structures with effects information for layer states in TimeLine models
string sourceFile = "4_animated.psd";
string outputFile = "output.psd";
using (var psdImage = (PsdImage)Image.Load(sourceFile))
{
    TimeLine timeLine = TimeLine.InitializeFrom(psdImage);
    int[] layerIds = timeLine.LayerIds;
    var layerStateEffects11 = timeLine.Frames[1].LayerStates[layerIds[1]].StateEffects;
    layerStateEffects11.AddDropShadow();
    layerStateEffects11.AddGradientOverlay();
    var layerStateEffects21 = timeLine.Frames[2].LayerStates[layerIds[1]].StateEffects;
    layerStateEffects21.AddStroke(FillType.Color);
    layerStateEffects21.IsVisible = false;
    timeLine.ApplyTo(psdImage);
    psdImage.Save(outputFile);
}
PSDNET-1230. Applying TimeLine layer state to layer in PsdImage
string sourceFile = "3_animated.psd";
string outputPsd = "output.psd";
string outputPng = "output.png";
using (var psdImage = (PsdImage)Image.Load(sourceFile, new PsdLoadOptions() { LoadEffectsResource = true }))
{
    TimeLine timeLine = TimeLine.InitializeFrom(psdImage);
    var layerIds = timeLine.LayerIds;
    var layerState11 = timeLine.Frames[1].LayerStates[layerIds[1]];
    timeLine.Frames[1].LayerStates[layerIds[1]].StateEffects.AddPatternOverlay();
    layerState11.BlendMode = BlendMode.Multiply;
    // Change active frame from 0 to 1 to activate applying of LayerState to Layer
    timeLine.ActiveFrame = 1;
    // Apply changes to PsdImage
    timeLine.ApplyTo(psdImage);
    psdImage.Save(outputPsd);
    psdImage.Save(outputPng, new PngOptions());
}
PSDNET-1266. Memory leak on the processing of specific files
string[] filesToLoad = new string[] { "testPsd0.psd", "testPsd1.psd", "testPsd2.psd" };
int inputNumber = GC.MaxGeneration;
#if NETCOREAPP
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
#endif
GC.Collect(inputNumber, GCCollectionMode.Forced);
GC.WaitForFullGCComplete();
double memCount = (double)Process.GetCurrentProcess().PrivateMemorySize64 / 1024 / 1024;
Console.WriteLine("Total used bytes before test: {0:N2} MiB", memCount);
double max = memCount;
for (int i = 0; i < 50; i++)
{
    int fileIndex = i % inputNumber;
    string sourceFile = Path.Combine(baseFolder, filesToLoad[fileIndex]);
    // CheckOpenSaving
    using (MemoryStream outputStream = new MemoryStream())
    {
        using (PsdImage psd = (PsdImage)Image.Load(sourceFile, new PsdLoadOptions { LoadEffectsResource = true }))
        {
            psd.Save(outputStream, new JpegOptions() { Quality = 100 });
        }
    }
#if NETCOREAPP
    GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
#endif
    GC.Collect(inputNumber, GCCollectionMode.Forced);
    GC.WaitForFullGCComplete();
    memCount = (double)Process.GetCurrentProcess().PrivateMemorySize64 / 1024 / 1024;
    max = Math.Max(max, memCount);
}
memCount = (double)Process.GetCurrentProcess().PrivateMemorySize64 / 1024 / 1024;
Console.WriteLine("Total used bytes after test: {0:N2} MiB", memCount);
Assert.IsTrue(Math.Abs(memCount - max) < 20, "Memory leak in base functionality found!");