Skip to content


Short script to add a timestamp on pictures

Here is a short script (1.6kb) to add a timestamp on all PNG pictures in a directory. It requires Python and the Python Image Library (PIL). In order to use it, modify some parameters in the beginning to suit your needs (images directory, font file and size, etc.) and launch ./timestampFiles.py. Here is a before/after example (size of pictures is reduced to fit in this blog):

Before/after example of adding a timestamp to a picture

Note 1: the font is not included in the script. Here, I used FreeSans which is a true free font (GNU GPL with font exception). It is available here (local copy, just the FreeSans font, 753kb).

Note 2: I chose to convert PNG images to JPG ones for 2 reasons. First, my capture script gives me PNG images (see previous posts). Second, I want to be able to copy all JPG pictures in a MJPEG movie. It shouldn’t be difficult to change the different file formats to suit your needs (ask me if you can’t do that).

Note 3: I guess this would also have been possible using a bash script and imagemagick, Perl or any other programming language ;-)

Possibly related posts: (automatically generated)

  1. Simple Sitemap.xml builder
  2. Some news about Jadoo
  3. How to remove files ending with ‘~’
  4. I give up!
  5. postr, simply puts your pictures on Flickr

Posted in Open Source, Projects.

Tagged with , , , , , , , .


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Continuing the Discussion

  1. Baby movements during sleep - epot's blog linked to this post on January 28, 2009

    [...] a while, here is why I got a TV tuner for my Linux laptop, took screen captures and wrote a script to add a timestamp on pictures … I wanted to know how my (then 5-month-old) son was sleeping (his mom can be reassured: I [...]