レイヤーマスクのサポート

この記事では、PSD画像のレイヤーマスクのサポート方法と、それらの画像の保存方法を説明します。以下にコードスニペットを提供しています。

String dataDir = Utils.getDataDir(SupportOfLayerMask.class) + "PSD/";
// Export of the psd with complex mask
String sourceFileName = dataDir + "MaskComplex.psd";
String exportPath = dataDir + "MaskComplex.png";
try (PsdImage im = (PsdImage) Image.load(sourceFileName)) {
// Export to PNG
PngOptions saveOptions = new PngOptions();
saveOptions.setColorType(PngColorType.TruecolorWithAlpha);
im.save(exportPath, saveOptions);
}

クリッピングマスクのサポート

この記事では、Aspose.PSDでPSDファイル内のクリッピングマスクをサポートする方法を説明します。以下にコードスニペットを提供しています。

String dataDir = Utils.getDataDir(SupportOfClippingMask.class) + "PSD/";
// Exposure layer editing
// Export of the psd with complex clipping mask
String sourceFileName = dataDir + "ClippingMaskComplex.psd";
String exportPath = dataDir + "ClippingMaskComplex.png";
try (PsdImage im = (PsdImage) Image.load(sourceFileName)) {
// Export to PNG
PngOptions saveOptions = new PngOptions();
saveOptions.setColorType(PngColorType.TruecolorWithAlpha);
im.save(exportPath, saveOptions);
}