Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save conholdate-gists/e7e71accbf9f928a608f50d5f27f0b59 to your computer and use it in GitHub Desktop.

Select an option

Save conholdate-gists/e7e71accbf9f928a608f50d5f27f0b59 to your computer and use it in GitHub Desktop.
Convert PSD to PNG with Conholdate.Total for Java
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