Aspose.PSD for .NET 23.2 - Release Notes

Key Summary Category
PSDNET-1359 Rework text rendering to improve text positioning, rendering, and support Enhancement
PSDNET-1270 Add ability to process Warp Effect though the public API Feature
PSDNET-1391 Add support of Bottom-to-bottom and Top-to-Top leading modes from Paragraph settings Feature
PSDNET-912 Change Font and Color for TextLayer PSD Bug
PSDNET-1022 Incorrect export of text at test TextUpdateTests, text is missing Bug
PSDNET-1221 Extra small text is missing after resizing of the bigger PSD image Bug
PSDNET-1301 Aspose.Psd for .NET textLayer.UpdateText() is printing ‘-’ (dash) as underscore in random manner for different data set Bug
PSDNET-1379 ResolutionSettings do not apply on export from PSD to PDF Bug

Public API Changes

Added APIs:

  • P:Aspose.PSD.ImageLoadOptions.PsdLoadOptions.AllowWarpRepaint
  • P:Aspose.PSD.FileFormats.Psd.Layers.Text.ITextStyle.NoBreak
  • T:Aspose.PSD.FileFormats.Psd.Layers.AdjustmentLayers.PosterizeLayer
  • P:Aspose.PSD.FileFormats.Psd.Layers.AdjustmentLayers.PosterizeLayer.Levels
  • M:Aspose.PSD.FileFormats.Psd.Layers.Layer.Save(System.IO.Stream)
  • T:Aspose.PSD.FileFormats.Psd.LeadingType
  • F:Aspose.PSD.FileFormats.Psd.LeadingType.BottomToBottom
  • F:Aspose.PSD.FileFormats.Psd.LeadingType.TopToTop

Removed APIs:

  • T:Aspose.PSD.FileFormats.Psd.LeadingMode
  • F:Aspose.PSD.FileFormats.Psd.LeadingMode.Auto
  • F:Aspose.PSD.FileFormats.Psd.LeadingMode.Manual

Usage examples:

PSDNET-912. Change Font and Color for TextLayer PSD

string fontsFolder = "Fonts";
string srcFile = "M1PDTT26052021001.psd";
string outputPsd = "result.psd";
string outputPng = "result.png";

FontSettings.SetFontsFolder(fontsFolder);

using (var image = (PsdImage)Image.Load(srcFile))
{
    TextLayer nameLayer = (TextLayer)image.Layers[9];
    var textPortion = nameLayer.TextData.Items[0];

    textPortion.Text = "MODESTO SR";
    textPortion.Style.FontName = FontSettings.GetAdobeFontName("Fugaz One");
    textPortion.Style.FillColor = Color.Red;

    nameLayer.TextData.UpdateLayerData();

    image.Save(outputPsd);
    image.Save(outputPng, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}

PSDNET-1022. Incorrect export of text at test TextUpdateTests, text is missing

string srcFile = "ComplexKerningExample.psd";
string outputPsd = "TextUpdateComplexKerningExample_.psd";
string outputPng = "TextUpdateComplexKerningExample_.png";

using (var image = (PsdImage)Image.Load(srcFile))
{
    for (int i = 0; i < image.Layers.Length; i++)
    {
        var layer = image.Layers[i] as TextLayer;

        if (layer != null)
        {
            layer.UpdateText("Text is updated");
        }
    }

    image.Save(outputPsd);
    image.Save(outputPng, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}

PSDNET-1221. Extra small text is missing after resizing of the bigger PSD image

string src = "textTest.psd";
string output = "output.png";

using (var psdImage = (PsdImage)Image.Load(src))
{
    psdImage.Resize(30, 30);

    psdImage.Save(output, new PngOptions());
}

PSDNET-1270. Add ability to process Warp Effect though the public API

string sourceFile = "source.psd";
string pngWarpedExport = "warped.png";
string psdWarpedExport = "warpFile.psd";

var warpLoadOptions = new PsdLoadOptions() { AllowWarpRepaint = true };

using (var image = (PsdImage)Image.Load(sourceFile, warpLoadOptions))
{
    image.Save(pngWarpedExport, new PngOptions());
    image.Save(psdWarpedExport, new PsdOptions());
}

PSDNET-1301. Aspose.Psd for .NET textLayer.UpdateText() is printing ‘-’ (dash) as underscore in random manner for different data set

string src = "TEST_PSD_FILE.PSD";
string output = "OUTPUTIMAGE.jpg";

using (PsdImage psdImage = (PsdImage)Image.Load(src))
{
    foreach (var layer in psdImage.Layers.Where(x => x.IsVisible))
    {
        if (layer is TextLayer)
        {
            TextLayer textLayer = layer as TextLayer;
            switch (layer.Name.Trim().ToUpper())
            {
                case "NAME":
                    textLayer.UpdateText("MR. JACK SMITH");
                    break;
                case "IDNO":
                    textLayer.UpdateText("OFF-022/GRP - 016");
                    break;
                case "DESIGNATION":
                    textLayer.UpdateText("OFFICER-001");
                    break;
                case "BLOODGROUP":
                    textLayer.UpdateText("AB-");
                    break;
                case "ADDRESS":
                    textLayer.UpdateText("BLOCK-A, STREET-7, APPT NO - 047, SECTOR-024");
                    break;
                case "PERMADDRESS":
                    textLayer.UpdateText("HOUSE NO - 42, LANE -025, PALM GREENS VIEW HOUSING SOCIETY, SECTOR - 45");
                    break;
            }
        }
    }

    psdImage.Save(output, new JpegOptions());
}

PSDNET-1379. ResolutionSettings do not apply on export from PSD to PDF

string input = "Datensatz 1.psd";
string output = "Datensatz 1.pdf";

using (var image = Image.Load(input, new PsdLoadOptions()))
{
    ResolutionSetting resolutionSetting = new ResolutionSetting(300, 300);

    image.Save(output, new PdfOptions()
    {
        ResolutionSettings = resolutionSetting
    });
}

PSDNET-1391. Add support of Bottom-to-bottom and Top-to-Top leading modes from Paragraph settings

string input = "leadingMode.psd";
string output = "output_leadingMode.png";

using (var psdImage = (PsdImage)Image.Load(input, new PsdLoadOptions()))
{
    IText text1 = ((TextLayer)psdImage.Layers[1]).TextData;
    foreach (var textPortion in text1.Items)
    {
        textPortion.Paragraph.LeadingType = LeadingType.TopToTop; // Change LeadingType value   
    }
    text1.Items[8].Text = "TopToTop";
    text1.Items[8].Style.FillColor = Color.ForestGreen;
    text1.UpdateLayerData();

    IText text2 = ((TextLayer)psdImage.Layers[2]).TextData;
    foreach (var textPortion in text2.Items)
    {
        textPortion.Paragraph.LeadingType = LeadingType.BottomToBottom; // Change LeadingType value   
    }
    text2.Items[8].Text = "BottomToBottom";
    text2.Items[8].Style.FillColor = Color.ForestGreen;
    text2.UpdateLayerData();

    psdImage.Save(output, new PngOptions());
}