Aspose.PSD for Java 24.6 - 릴리스 노트

요약 카테고리
PSDJAVA-628 그라데이션 맵 레이어 지원 구현 기능
PSDJAVA-629 [AI 형식] AI 형식에 XPacket 메타데이터 지원 추가 기능
PSDJAVA-630 팽창, 압축, 꼬기 유형의 와프 구현 기능
PSDJAVA-631 ArtBoard 레이어가 포함된 파일에서 Rgb 및 Lab 모드는 3채널 미만 및 4채널 초과를 포함할 수 없음 버그
PSDJAVA-632 특정 파일 처리 시 처리 영역 상단은 양수여야 함 (매개변수 ‘areaToProcess’) 버그
PSDJAVA-633 저장 후 캔버스 이미지가 잘림. 데이터는 손실되지만 미리보기는 올바름 버그

공개 API 변경

추가된 API:

  • M:com.aspose.psd.fileformats.ai.AiImage.getXmpData
  • M:com.aspose.psd.fileformats.psd.PsdImage.addGradientMapAdjustmentLayer
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.GrdmResource.setMaximumColor(com.aspose.psd.fileformats.psd.rawcolor.RawColor)
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.GrdmResource.setMinimumColor(com.aspose.psd.fileformats.psd.rawcolor.RawColor)
  • T:com.aspose.psd.fileformats.psd.layers.adjustmentlayers.GradientMapLayer
  • M:com.aspose.psd.fileformats.psd.layers.adjustmentlayers.GradientMapLayer.setGradientSettings(com.aspose.psd.fileformats.psd.layers.fillsettings.BaseGradientFillSettings)
  • M:com.aspose.psd.fileformats.psd.layers.adjustmentlayers.GradientMapLayer.getGradientSettings
  • M:com.aspose.psd.fileformats.psd.layers.fillsettings.NoiseGradientFillSettings.getExpansionCount
  • M:com.aspose.psd.fileformats.psd.layers.fillsettings.NoiseGradientFillSettings.setExpansionCount(short)
  • T:com.aspose.psd.fileformats.psd.layers.layerresources.GradientHelper
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.GradientHelper.#ctor
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.GradientHelper.gradientKindToStr(int)
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.GradientHelper.noiseColorModelToInt(short)
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.GradientHelper.noiseColorModelToStr(short)
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.GradientHelper.intToNoiseColorModel(short)
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.GradientHelper.strToGradientKind(java.lang.String)
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.GradientHelper.strToNoiseColorModel(java.lang.String)
  • F:com.aspose.psd.fileformats.psd.layers.layerresources.GradientHelper.StrGradientNoise
  • F:com.aspose.psd.fileformats.psd.layers.layerresources.GradientHelper.StrGradientSolid
  • F:com.aspose.psd.fileformats.psd.layers.layerresources.GradientHelper.StrModelHSB
  • F:com.aspose.psd.fileformats.psd.layers.layerresources.GradientHelper.StrModelLAB
  • F:com.aspose.psd.fileformats.psd.layers.layerresources.GradientHelper.StrModelRGB
  • F:com.aspose.psd.fileformats.psd.layers.layerresources.GradientHelper.IntModelRGB
  • F:com.aspose.psd.fileformats.psd.layers.layerresources.GradientHelper.IntModelLAB
  • F:com.aspose.psd.fileformats.psd.layers.layerresources.GradientHelper.IntModelHSB
  • M:com.aspose.psd.fileformats.psd.layers.fillsettings.BaseGradientFillSettings.getGradientName
  • M:com.aspose.psd.fileformats.psd.layers.fillsettings.BaseGradientFillSettings.setGradientName(java.lang.String)

제거된 API:

  • M:com.aspose.psd.fileformats.psd.layers.fillsettings.GradientFillSettings.getGradientName
  • M:com.aspose.psd.fileformats.psd.layers.fillsettings.GradientFillSettings.setGradientName(java.lang.String)
  • T:com.aspose.psd.fileformats.psd.layers.layerresources.GdflResourceHelper
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.GdflResourceHelper.#ctor
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.GdflResourceHelper.gradientKindToStr(int)
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.GdflResourceHelper.noiseColorModelToStr(short)
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.GdflResourceHelper.strToGradientKind(java.lang.String)
  • M:com.aspose.psd.fileformats.psd.layers.layerresources.GdflResourceHelper.strToNoiseColorModel(java.lang.String)
  • F:com.aspose.psd.fileformats.psd.layers.layerresources.GdflResourceHelper.StrGradientNoise
  • F:com.aspose.psd.fileformats.psd.layers.layerresources.GdflResourceHelper.StrGradientSolid
  • F:com.aspose.psd.fileformats.psd.layers.layerresources.GdflResourceHelper.StrModelHSB
  • F:com.aspose.psd.fileformats.psd.layers.layerresources.GdflResourceHelper.StrModelLAB
  • F:com.aspose.psd.fileformats.psd.layers.layerresources.GdflResourceHelper.StrModelRGB

사용 예제:

PSDJAVA-628. 그라데이션 맵 레이어 지원 구현

    public static void main(String[] args) {
        String sourceFile = "src/main/resources/gradient_map_src.psd";
        String outputFile = "src/main/resources/gradient_map_src_output.psd";

        try (PsdImage im = (PsdImage) Image.load(sourceFile)) {
            // 그라데이션 맵 조정 레이어 추가
            GradientMapLayer layer = im.addGradientMapAdjustmentLayer();
            layer.getGradientSettings().setReverse(true);

            im.save(outputFile);
        }

        // 저장된 변경 사항 확인
        try (PsdImage im = (PsdImage) Image.load(outputFile)) {
            GradientMapLayer gradientMapLayer = (GradientMapLayer) im.getLayers()[1];
            GradientFillSettings gradientSettings = (GradientFillSettings) gradientMapLayer.getGradientSettings();

            assertAreEqual(0.0, gradientSettings.getAngle());
            assertAreEqual((short) 4096, gradientSettings.getInterpolation());
            assertAreEqual(true, gradientSettings.getReverse());
            assertAreEqual(false, gradientSettings.getAlignWithLayer());
            assertAreEqual(false, gradientSettings.getDither());
            assertAreEqual(GradientType.Linear, gradientSettings.getGradientType());
            assertAreEqual(100, gradientSettings.getScale());
            assertAreEqual(0.0, gradientSettings.getHorizontalOffset());
            assertAreEqual(0.0, gradientSettings.getVerticalOffset());
            assertAreEqual("Custom", gradientSettings.getGradientName());
        }
    }

    static void assertAreEqual(Object expected, Object actual) {
        assertAreEqual(expected, actual, "Objects are not equal.");
    }

    static void assertAreEqual(Object expected, Object actual, String message) {
        if (!expected.equals(actual)) {
            throw new IllegalArgumentException(message);
        }
    }

PSDJAVA-629. [AI 형식] AI 형식에 XPacket 메타데이터 지원 추가

    public static void main(String[] args) {
        String sourceFile = "src/main/resources/ai_one.ai";

        String creatorToolKey = ":CreatorTool";
        String nPagesKey = "xmpTPg:NPages";
        String unitKey = "stDim:unit";
        String heightKey = "stDim:h";
        String widthKey = "stDim:w";

        String expectedCreatorTool = "Adobe Illustrator CC 22.1 (Windows)";
        String expectedNPages = "1";
        String expectedUnit = "Pixels";
        double expectedHeight = 768;
        double expectedWidth = 1366;

        try (AiImage image = (AiImage) Image.load(sourceFile)) {
            // Xmp 메타데이터가 추가되었습니다.
            var xmpMetaData = image.getXmpData();

            assertIsNotNull(xmpMetaData);

            // 이제 AI 파일의 Xmp 패키지에 액세스할 수 있습니다.
            var basicPackage = (XmpBasicPackage) xmpMetaData.getPackage(Namespaces.XmpBasic);
            XmpPackage package_ = xmpMetaData.getPackages()[4];
    
            // 이 패키지의 내용에 액세스할 수 있습니다.
            var creatorTool = basicPackage.get_Item(creatorToolKey).toString();
            var nPages = package_.get_Item(nPagesKey);
            var unit = package_.get_Item(unitKey);
            var height = Double.parseDouble(package_.get_Item(heightKey).toString());
            var width = Double.parseDouble(package_.get_Item(widthKey).toString());

            assertAreEqual(creatorTool, expectedCreatorTool);
            assertAreEqual(nPages, expectedNPages);
            assertAreEqual(unit, expectedUnit);
            assertAreEqual(height, expectedHeight);
            assertAreEqual(width, expectedWidth);
        }
    }

    static void assertAreEqual(Object expected, Object actual) {
        assertAreEqual(expected, actual, "Objects are not equal.");
    }

    static void assertAreEqual(Object expected, Object actual, String message) {
        if (!expected.equals(actual)) {
            throw new IllegalArgumentException(message);
        }
    }

    static void assertIsNotNull(Object testObject) {
        if (testObject == null) {
            throw new RuntimeException("테스트 오브젝트가 null입니다.");
        }
    }

PSDJAVA-630. 팽창, 압축 및 꼬기 유형의 와프 구현

    String[] files = {"Twist", "Squeeze", "Squeeze_vert", "Inflate"};

    for (String prefix : files) {
        String sourceFile = "src/main/resources/" + prefix + ".psd";
        String outputFile = "src/main/resources/" + prefix + "_export.png";

        PsdLoadOptions psdLoadOptions = new PsdLoadOptions();
        psdLoadOptions.setAllowWarpRepaint(true);
        psdLoadOptions.setLoadEffectsResource(true);
        try (PsdImage psdImage = (PsdImage) Image.load(sourceFile, psdLoadOptions)) {
            PngOptions pngOptions = new PngOptions();
            pngOptions.setColorType(PngColorType.TruecolorWithAlpha);
            psdImage.save(outputFile, pngOptions);
        }
    }

PSDJAVA-631. Rgb 및 Lab 모드는 3채널 미만 및 4채널 초과를 포함할 수 없음 ArtBoard 레이어가 있는 파일에서

    String sourceFile = "src/main/resources/Rgb5Channels.psb";
    String outputFile = "src/main/resources/Rgb5Channels_output.psd";

    try (PsdImage image = (PsdImage) Image.load(sourceFile)) {
        // 여기에서는 예외가 발생해서는 안 됨
        image.save(outputFile);
    }

PSDJAVA-632. 특정 파일 처리 시 처리 영역 상단은 양수여야 함 (매개변수 ‘areaToProcess’)

    String sourceFile = "src/main/resources/BANNERS_2_Intel-Gamer_psak.psd";
    String outputFile = "src/main/resources/BANNERS_2_Intel-Gamer_psak_out.psd";
    PsdLoadOptions psdLoadOptions = new PsdLoadOptions();
    psdLoadOptions.setLoadEffectsResource(true);
    psdLoadOptions.setAllowWarpRepaint(true);
    try (PsdImage image = (PsdImage) PsdImage.load(sourceFile, psdLoadOptions)) {
        image.save(outputFile);
        // 여기서 예외가 발생해서는 안 됨
    }

PSDJAVA-633. 저장 후 캔버스 이미지가 잘림. 데이터는 손실되지만 미리보기는 올바름

    String sourceFile = "src/main/resources/bigfile.psd";

    String outputFile = "src/main/resources/bigfile_output.psd";
    String outputPicture = "src/main/resources/bigfile.png";

    PsdLoadOptions loadOptions = new PsdLoadOptions();
    loadOptions.setLoadEffectsResource(true);
    loadOptions.setUseDiskForLoadEffectsResource(true);

    try (var psdImage = (PsdImage) Image.load(sourceFile, loadOptions)) {
        PsdOptions psdOptions = new PsdOptions();
        psdOptions.setCompressionMethod(CompressionMethod.RLE);
        // 여기에서 오류가 발생하지 않아야 함
        psdImage.save(outputFile, psdOptions);
    }

    try (var psdImage = (PsdImage) Image.load(outputFile, loadOptions)) {
        psdImage.resize(psdImage.getWidth() / 10, psdImage.getHeight() / 10);

        PngOptions pngOptions = new PngOptions();
        pngOptions.setColorType(PngColorType.TruecolorWithAlpha);
        // 여기에서 오류가 발생하지 않아야 함
        psdImage.save(outputPicture, pngOptions);
    }