Created
May 9, 2024 09:32
-
-
Save aspose-com-gists/18325de7ed057f8d27f03ef0871ae870 to your computer and use it in GitHub Desktop.
Convert TIFF to PSD in 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
package com.example; | |
import com.aspose.imaging.Image; | |
import com.aspose.imaging.fileformats.psd.ColorModes; | |
import com.aspose.imaging.fileformats.psd.CompressionMethod; | |
import com.aspose.imaging.imageoptions.PsdOptions; | |
// Convert TIFF to PSD in Java - Image Manipulation Library | |
public class Main | |
{ | |
public static void main(String... args) | |
{ | |
//Define the working directory. | |
String dataDir = "/files/"; | |
String sourceFileName = dataDir + "sample.tiff"; | |
// Create an object of the Image class and load the source TIFF image by calling the load method. | |
try (Image image = Image.load(sourceFileName)) | |
{ | |
// Instantiate an instance of the PsdOptions class. | |
PsdOptions ptions = new PsdOptions(); | |
// Call the setColorMode method to set the color mode. | |
ptions.setColorMode(ColorModes.Rgb); | |
// The setVersion function sets the PSD file version. | |
ptions.setVersion(4); | |
// Invoke the setCompressionMethod method to set the PSD compression method. | |
ptions.setCompressionMethod(CompressionMethod.RLE); | |
// Call the save method to save the PSD file to disk. | |
image.save(dataDir+ "tiffTopsd.psd", ptions); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment