Last active
March 31, 2023 18:10
How to Convert Tiff to PNG in Java. For more information: https://kb.aspose.com/imaging/java/how-to-convert-tiff-to-png-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
import com.aspose.imaging.Image; | |
import com.aspose.imaging.ImageOptionsBase; | |
import com.aspose.imaging.License; | |
import com.aspose.imaging.fileformats.tiff.TiffFrame; | |
import com.aspose.imaging.fileformats.tiff.TiffImage; | |
import com.aspose.imaging.imageoptions.PngOptions; | |
public class TIFFToPNGConvert { | |
public static void main (String[] args) { | |
String path = "/Users/KB/TestData/"; | |
// Apply the product license to convert PNG to Icon in Java | |
License pngToIcLicense = new License(); | |
pngToIcLicense.setLicense(path + "Conholdate.Total.Product.Family.lic"); | |
Image image = Image.load(path + "multiple_codes.png"); | |
// Applying product license to convert Tiff to PNG in C# | |
License TiffToPdfLicense = new License(); | |
TiffToPdfLicense.setLicense(path + "Conholdate.Total.Product.Family.lic"); | |
TiffImage tiffImage = (TiffImage)Image.load(path+ "AFREY-Original.tif"); | |
// Initialize the index variable to keep track of the frames inside the tiff | |
// image, Iterate through the tiff image frame collection and | |
// save the PNG image on the disk | |
int i = 0; | |
for (TiffFrame tiffFrame : tiffImage.getFrames()) | |
{ | |
tiffFrame.save(path + ++i + "_out.png", new PngOptions()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment