Skip to content

Instantly share code, notes, and snippets.

@ricardolee
Created September 23, 2016 01:52
Show Gist options
  • Save ricardolee/64713c64bc935f1b88cd3fe84548c07e to your computer and use it in GitHub Desktop.
Save ricardolee/64713c64bc935f1b88cd3fe84548c07e to your computer and use it in GitHub Desktop.
Convert PNG to JPEG
BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream(dates));
BufferedImage newBufferedImage = new BufferedImage(bufferedImage.getWidth(),
bufferedImage.getHeight(), BufferedImage.TYPE_INT_RGB);
newBufferedImage.createGraphics().drawImage(bufferedImage, 0, 0, Color.WHITE, null);
ImageIO.write(newBufferedImage, "jpg" , new FileOutputStream(TEST_DIR + "/" + OUTPUT_FILE));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment