Time-slice photography with Python (and the 2015 solar eclipse)

Time slices spanning three hours of very cloudy eclipse!

Time slices spanning three hours (left-to-right) of a very cloudy solar eclipse!

There was a solar eclipse in March, and all I saw was cloud.  I was prepared for this, of course, what with living in the UK these days.  But all was not lost!  I still got a photograph (indirectly) of the whole thing in the form of this time-slice, which shows a period of about three hours from left to right.  I wrote a Python script to do all the legwork for me, which I’ve put on GitHub should anyone want it.

A bit more about the eclipse photo.  The blue-sky plan back in March was literally that – to produce a much higher time-resolution image (thinner slices) than above with the sun in full view over the river.  The result would have been a bright streak across the sky, but getting darker toward the middle and back to full brightness before the sun exited on the right.  In hindsight I imagine that, like in a Discworld book, the gods of weather were having a good old chuckle at my plans, in the way one might laugh at a duckling trying to follow its mum up a set of foot-high steps.  Anyway..

A bit about what a time-slice is.  A time-slice image shows the same scene at different times, usually with a sequence of strips or ‘slices’ progressing from one moment to the next.  It’s almost like a time-lapse movie shown in one shot, and with some careful attention to the size and placement of the slices and subject matter you can create some really interesting images.  I’d encourage anyone to do a quick Google image search for some inspirational examples of this technique.

So onto the code.  Time-slicing is a perfect job for one of my favourite Python modules, the Python Imaging Library.  At present I’ve only written basic functions.  You can:

  • create a time-slice object, from which you can generate different slices;
  • point the object at a folder containing all your (sequentially-named) photos;
  • specify a rotation for all input images in 90-degree increments, if needed;
  • generate a time-slice image with linear slices progressing from left to right, top to bottom, right to left, or bottom to top;
  • specify a file ‘interval’ so that only every second, third etc. image is included in the sliced image (this is how you control the number of slices); and
  • apply a border to every slice, of whatever width and colour you’d like.

The code will work with all PIL-supported image types (jpg, tif, and a few others).  PIL doesn’t support RAW image files, so it’s a good idea to ensure that the input images are properly exposed and have the correct white balance setting applied.  Just like with time-lapse photography, it often doesn’t look great if exposure and white-balance are simply set to ‘auto’ because the variation from shot to shot can be distracting.

I’d love to see what others can come up with using this.  Get in touch if you’d like to share your results :)

Here’s the GitHub link: https://github.com/labjg/tslice

Advertisements

One thought on “Time-slice photography with Python (and the 2015 solar eclipse)

  1. Pingback: Time-sliced #SuperBloodMoon lunar eclipse 2015 | LabJG: James Gilbert

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s