private void makeGIFfile(String pngFilePath, String gifFilePath) { File input = new File(pngFilePath); File output = new File(gifFilePath); BufferedImage bufferedImage; try { bufferedImage = ImageIO.read(input); //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) { e.printStackTrace(); } }
All one can think and do in a short time is to think what one already knows and to do as one has always done!
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.