Java convert PNG Image to GIF

 private void makeGIFfile(String pngFilePath, String gifFilePath) {

  File input = new File(pngFilePath);
  File output = new File(gifFilePath);
  BufferedImage bufferedImage;

  try {
   bufferedImage =;
   //Create a blank, RGB, same width and height, and a white background
   BufferedImage newBufferedImage = new BufferedImage(bufferedImage.getWidth(),
     bufferedImage.getHeight(), BufferedImage.TYPE_INT_RGB);
   newBufferedImage.createGraphics().drawImage(bufferedImage, 0, 0, Color.WHITE, null);

   //Write the image file with GIF extension
   ImageIO.write(newBufferedImage, "gif", output);

  } catch (IOException e) {


No comments:

Post a Comment

NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.