How can I convert GIFs to PNGs using Java?

John Zukowski

The Image I/O libraries added to Java 1.4 perform this for you:

  File inputFile = new File(filename);
  BufferedImage input = ImageIO.read(inputFile);
  File outputFile = new File(outfilename);
  ImageIO.write(input, "PNG", outputFile);
To get a list of available format one can read, use ImageIO.getReaderFormatNames(). (gif, jpg, png)

To get the list of available writable formats, use getWriterFormatNames() (jpg, png).

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact