Aspose.PSD for Java 20.3 - Release Notes

Contents
[ ]
Key Summary Category
PSDJAVA-133 Convert Adobe Illustrator files into PDFs Feature
PSDJAVA-134 Add ability to render different styles in one text layer Feature
PSDJAVA-135 Support of Black and White Adjustment Layer Feature
PSDJAVA-137 Add support of export AI format (Version 8) to other formats Feature
PSDJAVA-138 Support of PassThrough Blending Mode processing (Used for Layer Group Only). Feature
PSDJAVA-136 Exception: Image load failed on loading image with empty Unicode Alpha Names Resource Bug
PSDJAVA-139 Incorrect output after changing visibility of a LayerGroup Bug
PSDJAVA-140 Exception on loading PSD image: Color section (DropShadow Resource) must contain 3 color components for RGB or 4 color components for CMYK Bug
PSDJAVA-141 Exception if try to draw on newly created layer if simple version of Constructor is used Bug

Public API Changes

Added APIs:

  • M:com.aspose.psd.fileformats.psd.PsdImage.addBlackWhiteAdjustmentLayer
  • M:com.aspose.psd.fileformats.psd.PsdImage.addExposureAdjustmentLayer(float)
  • M:com.aspose.psd.fileformats.psd.PsdImage.addExposureAdjustmentLayer(float,float)
  • T:com.aspose.psd.fileformats.psd.PsdVersion
  • F:com.aspose.psd.fileformats.psd.PsdVersion.Psb
  • F:com.aspose.psd.fileformats.psd.PsdVersion.Psd
  • F:com.aspose.psd.fileformats.psd.layers.BlendMode.Absent
  • M:com.aspose.psd.fileformats.psd.layers.ChannelInformation.#ctor(short,byte[],byte[])
  • M:com.aspose.psd.fileformats.psd.layers.Layer.#ctor(com.aspose.psd.RasterImage)
  • M:com.aspose.psd.fileformats.psd.layers.Layer.#ctor(com.aspose.psd.internal.ij.k,com.aspose.psd.IColorPalette)
  • M:com.aspose.psd.fileformats.psd.layers.LayerGroup.getBlendModeKey
  • M:com.aspose.psd.fileformats.psd.layers.LayerGroup.setBlendModeKey(long)
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.CurvesContinuousManager.getChannelsCount
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.CurvesContinuousManager.isChannelUsed(int)
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.CurvesDiscreteManager.#ctor(int)
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.CurvesDiscreteManager.getChannelsCount
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.CurvesDiscreteManager.isChannelUsed(int)
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.CurvesManager.getChannelsCount
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.CurvesManager.isChannelUsed(int)
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.LayerSectionResource.setBlendModeKey(long)
  • M:com.aspose.psd.fileformats.psd.layers.text.IText.producePortions(java.lang.String[],com.aspose.psd.fileformats.psd.layers.text.ITextStyle,com.aspose.psd.fileformats.psd.layers.text.ITextParagraph)
  • M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.getBaselineShift
  • M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.getFauxBold
  • M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.getFauxItalic
  • M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.getFontBaseline
  • M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.getFontCaps
  • M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.getStrikethrough
  • M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.getUnderline
  • M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.setBaselineShift(double)
  • M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.setFauxBold(boolean)
  • M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.setFauxItalic(boolean)
  • M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.setFontBaseline(int)
  • M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.setFontCaps(int)
  • M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.setLeading(double)
  • M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.setStrikethrough(boolean)
  • M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.setUnderline(boolean)
  • T:com.aspose.psd.fileformats.psd.layers.text.rendering.FontBaseline
  • F:com.aspose.psd.fileformats.psd.layers.text.rendering.FontBaseline.None
  • F:com.aspose.psd.fileformats.psd.layers.text.rendering.FontBaseline.Subscript
  • F:com.aspose.psd.fileformats.psd.layers.text.rendering.FontBaseline.Superscript
  • T:com.aspose.psd.fileformats.psd.layers.text.rendering.FontCaps
  • F:com.aspose.psd.fileformats.psd.layers.text.rendering.FontCaps.AllCaps
  • F:com.aspose.psd.fileformats.psd.layers.text.rendering.FontCaps.None
  • F:com.aspose.psd.fileformats.psd.layers.text.rendering.FontCaps.SmallCaps
  • M:com.aspose.psd.sources.StreamSource.#ctor(java.io.OutputStream)
  • M:com.aspose.psd.sources.StreamSource.#ctor(java.io.OutputStream,boolean)

Removed APIs:

  • M:com.aspose.psd.fileformats.psd.layers.Layer.setVisibleInGroup(boolean)
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.LayerSectionResource.setBlendModeKey(java.lang.String)
  • M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.setLeading(int)

Usage examples:

PSDJAVA-133. Convert Adobe Illustrator files into PDFs

 String inFile = "rect2_color.ai";

String outFile = "rect2_color.ai_output.pdf";

AiImage aiImage = (AiImage)Image.load(inFile);

try

{

    aiImage.save(outFile, new PdfOptions());

}

finally

{

    aiImage.dispose();

}

PSDJAVA-134. Add ability to render different styles in one text layer

 String inFilePath = "text212.psd";

String outFilePath = "Output_text212.psd";

PsdImage image = (PsdImage)Image.load(inFilePath);

try

{

    TextLayer textLayer = (TextLayer)image.getLayers()[1];

    IText textData = textLayer.getTextData();

    ITextStyle defaultStyle = textData.producePortion().getStyle();

    ITextParagraph defaultParagraph = textData.producePortion().getParagraph();

    defaultStyle.setFillColor(Color.getDimGray());

    defaultStyle.setFontSize(51);

    textData.getItems()[1].getStyle().setStrikethrough(true);

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

    newPortions[0].getStyle().setUnderline(true); // edit text style "E=mc"

    newPortions[1].getStyle().setFontBaseline(FontBaseline.Superscript); // edit text style "2\r"

    newPortions[2].getStyle().setFauxBold(true); // edit text style "Bold"

    newPortions[3].getStyle().setFauxItalic(true); // edit text style "Italic\r"

    newPortions[3].getStyle().setBaselineShift(-25); // edit text style "Italic\r"

    newPortions[4].getStyle().setFontCaps(FontCaps.SmallCaps); // edit text style "Lowercasetext"

    for (ITextPortion newPortion : newPortions)

    {

        textData.addPortion(newPortion);

    }

    textData.updateLayerData();

    image.save(outFilePath);

}

finally

{

    image.dispose();

}

PSDJAVA-135. Support of Black and White Adjustment Layer

 // Example of the support of adding the black white adjustment layer at runtime.

String inFileName = "Stripes.psd";

String outFileName = "Output" + inFileName;

PsdImage image = (PsdImage)Image.load(inFileName);

try

{

    BlackWhiteAdjustmentLayer newLayer = image.addBlackWhiteAdjustmentLayer();

    newLayer.setName("BlackWhiteAdjustmentLayer");

    newLayer.setReds(22);

    newLayer.setYellows(92);

    newLayer.setGreens(70);

    newLayer.setCyans(79);

    newLayer.setBlues(7);

    newLayer.setMagentas(28);

    image.save(outFileName, new PsdOptions());

}

finally

{

    image.dispose();

}

// Example of the black white adjustment layer support.

inFileName = "BlackWhiteAdjustmentLayerStripesMask.psd";

outFileName = "Output" + inFileName;

PsdImage image1 = (PsdImage)Image.load(inFileName);

try

{

    BlackWhiteAdjustmentLayer blwhLayer = (BlackWhiteAdjustmentLayer)image1.getLayers()[1];

    blwhLayer.setReds(15);

    blwhLayer.setYellows(25);

    blwhLayer.setGreens(35);

    blwhLayer.setCyans(10);

    blwhLayer.setBlues(50);

    blwhLayer.setMagentas(105);

    blwhLayer.setUseTint(true);

    blwhLayer.setBwPresetKind(4);

    blwhLayer.setBlackAndWhitePresetFileName("bwPresetFileName");

    blwhLayer.setTintColorRed(60);

    blwhLayer.setTintColorGreen(80);

    blwhLayer.setTintColorBlue(200);

    image1.save(outFileName, new PsdOptions());

}

finally

{

    image1.dispose();

}

PSDJAVA-137. Add support of export AI format (Version 8) to other formats

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

String inFileName = "form_8.ai";

String outFileNamePrefix = "form_8_export";

AiImage image = (AiImage)Image.load(inFileName);

try

{

    image.save(outFileNamePrefix + ".psd", new PsdOptions());

    PngOptions pngOptions = new PngOptions();

    pngOptions.setColorType(PngColorType.TruecolorWithAlpha);

    image.save(outFileNamePrefix + ".png", pngOptions);

}

finally

{

    image.dispose();

}

PSDJAVA-138. Support of PassThrough Blending Mode processing (Used for Layer Group Only).

 class LocalScope

{

    void assertIsTrue(boolean condition, String message)

    {

        if (!condition)

        {

            throw new FormatException(message);

        }

    }

}

LocalScope localScope = new LocalScope();

String inFileName = "Apple.psd";

String outFileName = "Output" + inFileName;

PsdImage image = (PsdImage)Image.load(inFileName);

try

{

    localScope.assertIsTrue(image.getLayers().length >= 23, "There is not 23rd layer.");

    LayerGroup layer = (LayerGroup)image.getLayers()[23];

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

    localScope.assertIsTrue(layer.getName().equals("AdjustmentGroup"), "The 23rd layer name is not 'AdjustmentGroup'.");

    localScope.assertIsTrue(layer.getBlendModeKey() == BlendMode.PassThrough, "AdjustmentGroup layer should have 'pass through' blend mode.");

    image.save(outFileName, new PsdOptions());

    PngOptions pngOptions = new PngOptions();

    pngOptions.setColorType(PngColorType.TruecolorWithAlpha);

    image.save("OutputApple.png", pngOptions);

    layer.setBlendModeKey(BlendMode.Normal);

    image.save("Normal" + outFileName, new PsdOptions());

    PngOptions pngOptions1 = new PngOptions();

    pngOptions1.setColorType(PngColorType.TruecolorWithAlpha);

    image.save("NormalOutputApple.png", pngOptions1);

}

finally

{

    image.dispose();

}

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

 String inFilePath = "apple.psd";

PsdImage psdImage = null;

try

{

    // Here we should get no exceptions

    psdImage = (PsdImage)Image.load(inFilePath);

}

finally

{

    if (psdImage != null) psdImage.dispose();

}

PSDJAVA-139. Incorrect output after changing visibility of a LayerGroup

 String inFileName = "input.psd";

String outFileName = "output.psd";

// Make changes in layer names and save it

PsdImage image = (PsdImage)Image.load(inFileName);

try

{

    for (int i = 0; i < image.getLayers().length; i++)

    {

        Layer layer = image.getLayers()[i];

        // Turn off everything inside a group

        if (layer instanceof LayerGroup)

        {

            layer.setVisible(false);

        }

    }

    image.save(outFileName);

}

finally

{

    image.dispose();

}

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

 String inFilePath = "sss0136=GUID-SSS0136=1=ar-sa=Low.psd";

PsdImage image = null;

try

{

    image = (PsdImage)PsdImage.load(inFilePath);

}

finally

{

    if (image != null) image.dispose();

}       

PSDJAVA-141. 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;

PsdImage image = new PsdImage(width, height);

try

{

    Layer layer = new Layer();

    layer.setBottom(height);

    layer.setRight(width);

    image.addLayer(layer);

    Graphics graphic = new Graphics(layer);

    graphic.clear(Color.getYellow());

    // draw a rectangle with Pen tool

    graphic.drawRectangle(new Pen(Color.getRed()), new Rectangle(30, 10, 40, 80));

    // draw another rectangle with Solid Brush in Blue color

    graphic.drawRectangle(new Pen(new SolidBrush(Color.getBlue())), new Rectangle(10, 30, 80, 40));

    image.save(outputFile);

}

finally

{

    image.dispose();

}