Esporta Gruppo di Livelli in Immagine
Contents
[
Hide
]
Esporta Gruppo di Livelli in Immagine
Aspose.PSD supporta l’esportazione di gruppi di livelli in immagini. A questo scopo, l’API fornisce la classe LayerGroup.
Il seguente frammento di codice dimostra come esportare gruppi di livelli in immagini.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(); | |
} |