Adding a date/time stamp to a jpeg image in Java

I’ve been looking for a simple tool to add a date/time stamp to some jpeg images. There are quite a lot of tools to do this but they all tend to cost money. I decided to make my own in Java. The actual process of loading a jpeg, adding a stamp and then saving it again is very simple. The below snippet will do the job.

BufferedImage bi =;
Graphics2D graphics = bi.createGraphics();
Font font = new Font("ARIAL", Font.PLAIN, 20);
graphics.drawString(stamp, 50, 50);
ImageIO.write(bi, "jpg", targetFile);

I added some options (you can change font size, position, colour) to meet my needs. You can download it for free from It is very basic – command line only – but does the job well enough. The Java source code and Eclipse project files are also available for download.

Leave a Reply

Your email address will not be published. Required fields are marked *

Do NOT fill this !