Java: How to create dynamic PNGs, JPGs, GIFs.

Sometimes you need to create graphics, or compose images and have them saved as regular PNGs, JPEGs or GIFs. Here’s a quick and dirty reference of how to do it with BufferedImages, Graphics2D and javax.imageio.*. Very straightforward. [java] import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; … //1. Create a BufferedImage, […]