For more details, please visit Convert PSD to TIFF Image Programmatically with Java
Last active
December 23, 2021 05:54
-
-
Save aspose-com-gists/6c6ccd35a9d4cda3d945e766554b9ae6 to your computer and use it in GitHub Desktop.
Convert PSD to TIFF Image with Compression Programmatically using Java
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
// Load a PSD file as an input image | |
Image psdImage = Image.load("layers.psd"); | |
// Create an instance of TiffOptions | |
TiffOptions options = new TiffOptions(TiffExpectedFormat.TiffDeflateRgb); | |
// Set AdobeDeflate as TiffCompression method | |
options.setCompression(TiffCompressions.AdobeDeflate); | |
// Save output TIFF image | |
psdImage.save("TIFFwithDeflateCompression_out.tiff", options); |
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
// Load a PSD file as an image and cast it into PsdImage | |
PsdImage psdImage = (PsdImage)com.aspose.psd.Image.load(dataDir + "layers.psd"); | |
// Create an instance of TiffOptions for the resultant image | |
TiffOptions outputSettings = new TiffOptions(TiffExpectedFormat.Default); | |
// Set BitsPerSample, Compression, Photometric mode and graycale palette | |
int[] ushort = {4}; | |
outputSettings.setBitsPerSample(ushort); | |
outputSettings.setCompression(TiffCompressions.Lzw); | |
outputSettings.setPhotometric(TiffPhotometrics.Palette); | |
outputSettings.setPalette(ColorPaletteHelper.create4BitGrayscale(true)); | |
// Save output TIFF image | |
psdImage.save("SampleTiff_out.tiff", outputSettings); |
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
// Load an existing PSD image as Image | |
com.aspose.psd.Image image = com.aspose.psd.Image.load("Photoshop.psd"); | |
// Create an instance of TiffOptions class | |
com.aspose.psd.imageoptions.TiffOptions options = new com.aspose.psd.imageoptions.TiffOptions(com.aspose.psd.fileformats.tiff.enums.TiffExpectedFormat.Default); | |
// Convert PSD to Tiff | |
image.save("PSD-to-Tiff.tiff", options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment