Ekspor Grup Layer ke gambar

Ekspor Grup Layer ke gambar

Aspose.PSD mendukung eksport grup layer ke gambar. Untuk ini, API menyediakan kelas LayerGroup.

Potongan kode berikut menunjukkan cara meng-ekspor grup layer ke gambar.

// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-Java
PsdImage psdImage = null;
try {
psdImage = (PsdImage) Image.load(sourceDir + "ExportLayerGroupToImageSample.psd");
// folder with background
LayerGroup bgFolder = (LayerGroup) psdImage.getLayers()[0];
// folder with content
LayerGroup contentFolder = (LayerGroup) psdImage.getLayers()[4];
bgFolder.save(outputDir + "background.png", new PngOptions());
contentFolder.save(outputDir + "content.png", new PngOptions());
} finally {
if (psdImage != null) psdImage.dispose();
}