L'esempio sotto riportato e' sostanzialmente autoesplicativo
-----------------------------------------
package com.test.png;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class Scrivi {
private static BufferedImage bimage;
public static void main(String[] args) {
bimage = new BufferedImage(100,100,BufferedImage.TYPE_INT_RGB);
int rgb = 0xFF00FF00;
for (int s=10;s<90;++s) bimage.setRGB(s, s, rgb);
File f = new File("/home/luca/immagine_java.png");
try {
ImageIO.write(bimage, "PNG", f);
} catch (IOException e) {
e.printStackTrace();
}
}
}