Created
December 10, 2025 08:11
-
-
Save conholdate-gists/e7e71accbf9f928a608f50d5f27f0b59 to your computer and use it in GitHub Desktop.
Convert PSD to PNG with Conholdate.Total for Java
This file contains hidden or 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
| import com.aspose.total.Image; | |
| import com.aspose.total.ImageLoadOptions; | |
| import com.aspose.total.ImageSaveOptions; | |
| import com.aspose.total.fileformats.png.PngOptions; | |
| public class PsdToPng { | |
| public static void main(String[] args) throws Exception { | |
| // Path to the source PSD file | |
| String sourcePath = "input.psd"; | |
| // Load the PSD file | |
| Image image = Image.load(sourcePath, new ImageLoadOptions()); | |
| // Configure PNG save options (optional) | |
| PngOptions pngOptions = new PngOptions(); | |
| pngOptions.setColorType(PngOptions.ColorType.TRUECOLOR_WITH_ALPHA); // Preserve transparency | |
| pngOptions.setCompressionLevel(6); // Balance between size and speed | |
| // Save the image as PNG | |
| String outputPath = "output.png"; | |
| image.save(outputPath, new ImageSaveOptions(pngOptions)); | |
| System.out.println("PSD has been successfully converted to PNG at: " + outputPath); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment