04
Dec

Add a timestamp to screenshot

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;

public class Metadata {

	public static void main(String[] args) throws Exception {
		BufferedImage image = ImageIO.read(new File("c:\\myImage.jpeg"));
		Graphics g = image.getGraphics();
		g.setFont(g.getFont().deriveFont(10f));
		g.drawString("(c) Defect", 10, 10);
		g.dispose();

		ImageIO.write(image, "png", new File("c:\\test1.png"));
	}

}