Aspose.PSD for .NET 20.3 - Release Notes

** 

Key Summary Category
PSDNET-188 Support of .Net Core Feature
PSDNET-523 Convert Adobe Illustrator files into PDFs Feature
PSDNET-212 Add ability to render different styles in one text layer Feature
PSDNET-144 Support of Black and White Adjustment Layer Feature
PSDNET-233 Add support of export AI format (Version 8) to other formats Feature
PSDNET-540 Support of PassThrough Blending Mode processing (Used for Layer Group Only). Feature
PSDNET-539 Exception: Image load failed on loading image with empty Unicode Alpha Names Resource Bug
PSDNET-541 Incorrect output after changing visibility of a LayerGroup Bug
PSDNET-516 Exception on loading PSD image: Color section (DropShadow Resource) must contain 3 color components for RGB or 4 color components for CMYK Bug
PSDNET-536 Exception if try to draw on newly created layer if simple version of Constructor is used Bug

Public API Changes

Added APIs:

  • T:Aspose.PSD.FileFormats.Psd.FontBaseline
  • F:Aspose.PSD.FileFormats.Psd.FontBaseline.None
  • F:Aspose.PSD.FileFormats.Psd.FontBaseline.Superscript
  • F:Aspose.PSD.FileFormats.Psd.FontBaseline.Subscript
  • T:Aspose.PSD.FileFormats.Psd.FontCaps
  • F:Aspose.PSD.FileFormats.Psd.FontCaps.None
  • F:Aspose.PSD.FileFormats.Psd.FontCaps.SmallCaps
  • F:Aspose.PSD.FileFormats.Psd.FontCaps.AllCaps
  • M:Aspose.PSD.FileFormats.Psd.PsdImage.AddBlackWhiteAdjustmentLayer
  • F:Aspose.PSD.FileFormats.Psd.Layers.BlendMode.Absent
  • P:Aspose.PSD.FileFormats.Psd.Layers.LayerGroup.BlendModeKey
  • P:Aspose.PSD.FileFormats.Psd.Layers.Text.ITextStyle.FauxBold
  • P:Aspose.PSD.FileFormats.Psd.Layers.Text.ITextStyle.FauxItalic
  • P:Aspose.PSD.FileFormats.Psd.Layers.Text.ITextStyle.Underline
  • P:Aspose.PSD.FileFormats.Psd.Layers.Text.ITextStyle.Strikethrough
  • P:Aspose.PSD.FileFormats.Psd.Layers.Text.ITextStyle.FontBaseline
  • P:Aspose.PSD.FileFormats.Psd.Layers.Text.ITextStyle.BaselineShift
  • P:Aspose.PSD.FileFormats.Psd.Layers.Text.ITextStyle.FontCaps
  • M:Aspose.PSD.FileFormats.Psd.Layers.Text.IText.ProducePortions(System.String[],Aspose.PSD.FileFormats.Psd.Layers.Text.ITextStyle,Aspose.PSD.FileFormats.Psd.Layers.Text.ITextParagraph)

Removed APIs:

  • None

Usage examples:

PSDNET-523. Convert Adobe Illustrator files into PDFs

 string sourceFile = "rect2_color.ai";

using (var aiImage = (AiImage)Image.Load(sourceFile))

{

    aiImage.Save("rect2_color.ai_output.pdf", new PdfOptions());

}

PSDNET-212. Add ability to render different styles in one text layer

 string sourceFile = "text212.psd";

string ethalonFile = "Ethalon_text212.psd";

string outputFile = "Output_text212.psd";

using (var img = (PsdImage)Image.Load(sourceFile))

{

    TextLayer textLayer = (TextLayer)img.Layers[1];

    IText textData = textLayer.TextData;

    ITextStyle defaultStyle = textData.ProducePortion().Style;

    ITextParagraph defaultParagraph = textData.ProducePortion().Paragraph;

    defaultStyle.FillColor = Color.DimGray;

    defaultStyle.FontSize = 51;

    textData.Items[1].Style.Strikethrough = true;

    ITextPortion[] newPortions = textData.ProducePortions(new string[] { "E=mc",  "2\r",  "Bold",  "Italic\r",  "Lowercasetext" }, defaultStyle, defaultParagraph);

    newPortions[0].Style.Underline = true; // edit text style "E=mc"

    newPortions[1].Style.FontBaseline = FontBaseline.Superscript; // edit text style "2\r"

    newPortions[2].Style.FauxBold = true; // edit text style "Bold"

    newPortions[3].Style.FauxItalic = true; // edit text style "Italic\r"

    newPortions[3].Style.BaselineShift = -25; // edit text style "Italic\r"

    newPortions[4].Style.FontCaps = FontCaps.SmallCaps; // edit text style "Lowercasetext"

    foreach (var newPortion in newPortions)

    {

        textData.AddPortion(newPortion);

    }

    textData.UpdateLayerData();

    img.Save(outputFile);

}

PSDNET-233. Add support of export AI format (Version 8) to other formats

 // Example of exporting AI file to PSD and PNG format

string sourceFileName = "form_8.ai";

string outputFileName = "form_8_export";

using (AiImage image = (AiImage)Image.Load(sourceFileName))

{

    image.Save(outputFileName + ".psd", new PsdOptions());

    image.Save(outputFileName + ".png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });

}

PSDNET-540. Support of PassThrough Blending Mode processing (Used for Layer Group Only).

 void AssertIsTrue(bool condition, string message)

{

    if (!condition)

    {

        throw new FormatException(message);

    }

}

string sourceFileName = "Apple.psd";

string outputFileName = "Output" + sourceFileName;

using (PsdImage image = (PsdImage)Image.Load(sourceFileName))

{

    AssertIsTrue(image.Layers.Length >= 23, "There is not 23rd layer.");

    var layer = image.Layers[23] as LayerGroup;

    AssertIsTrue(layer != null, "The 23rd layer is not a layer group.");

    AssertIsTrue(layer.Name == "AdjustmentGroup", "The 23rd layer name is not 'AdjustmentGroup'.");

    AssertIsTrue(layer.BlendModeKey == BlendMode.PassThrough, "AdjustmentGroup layer should have 'pass through' blend mode.");

    image.Save(outputFileName, new PsdOptions());

    image.Save("OutputApple.png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });

    layer.BlendModeKey = BlendMode.Normal;

    image.Save("Normal" + outputFileName, new PsdOptions());

    image.Save("NormalOutputApple.png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });

}

SPSDNET-180. Updating text layer text throws exception

 // Updating text layer text throws exception

string filePath = "FlipVertical.psd";

string outputPath = "FlipVertical_changed.psd";

var newText = "Test";

using (var image = Image.Load(filePath))

{

    var psdImage = image as PsdImage;

    if (image == null)

    {

        return;

    }

    var layers = psdImage.Layers;

    for (var index = layers.Length - 1; index >= 0; index--)

    {

        var layer = layers[index] as TextLayer;

        if (layer == null)

        {

            continue;

        }

        layer.UpdateText(newText);

    }

    var imageOptions = new PsdOptions(psdImage);

    psdImage.Save(outputPath, imageOptions);

}

PSDNET-182. Saving PSD image after RotateFlip operation produces corrupted file which could not be open.

 string sourceFileName = "1.psd";

RotateFlipType flipType = RotateFlipType.Rotate270FlipXY;

string outFileNamePsd = "RotateFlipTest2617.psd";

using (PsdImage image = (PsdImage)Image.Load(sourceFileName))

{

    image.RotateFlip(flipType);

    image.Save(outFileNamePsd);

}

// Should be executed without exceptions

using (PsdImage image = (PsdImage)Image.Load(outFileNamePsd)) 

{

    // Do nothing

}

PSDNET-539. Exception: Image load failed on loading image with empty Unicode Alpha Names Resource

 string sourcePath = "apple.psd";

using (var psdImage = (PsdImage)Image.Load(sourcePath)) // Here we should get no exceptions

{

    // do nothing

}

PSDNET-541. Incorrect output after changing visibility of a LayerGroup

 string sourceFile = "input.psd";

string outputFile = "output.psd";

// make changes in layer names and save it

using (var image = (PsdImage)Image.Load(sourceFile))

{

    for (int i = 0; i < image.Layers.Length; i++)

    {

        var layer = image.Layers[i];

        // Turn off everything inside a group

        if (layer is LayerGroup)

        {

            layer.IsVisible = false;

        }

    }

    image.Save(outputFile);

}

PSDNET-516. Exception on loading PSD image: Color section (DropShadow Resource) must contain 3 color components for RGB or 4 color components for CMYK

 string sourceFile = "sss0136=GUID-SSS0136=1=ar-sa=Low.psd";

using (var img = (PsdImage)Image.Load(sourceFile)) // Here we should get no exceptions

{

    // do nothing

}

PSDNET-536. Exception if try to draw on newly created layer if simple version of Constructor is used

 string outputFile = "output.psd";

int width = 100;

int height = 100;

using (var image = new PsdImage(width, height))

{

    var layer = new Layer();

    layer.Bottom = height;

    layer.Right = width;

    image.AddLayer(layer);

    Graphics graphic = new Graphics(layer);

    graphic.Clear(Color.Yellow);

    // draw a rectangle with Pen tool

    graphic.DrawRectangle(new Pen(Color.Red), new Rectangle(30, 10, 40, 80));

    // draw another rectangle with Solid Brush in Blue color

    graphic.DrawRectangle(new Pen(new SolidBrush(Color.Blue)), new Rectangle(10, 30, 80, 40));

    image.Save(outputFile);

}