Recording a sequence of thermal images over time means time-based analyses are possible, but the fun part is seeing your pictures move!  Let's convert a sequence of BMP images into a colorful motion GIF like this one.

Using ConvertBMPto8bit

This sketch will begin just like the last one. Open the sketch in Processing but don't run it.  Use Sketch>Show sketch folder to open the home folder, and either locate or create a data folder inside it. Choose a sequence of BMP images from your camera's flash storage and copy/paste it into the data folder.  Then run ConvertBMPto8bit.

Did anything happen? Some text appeared in the output part of the main window at the bottom, then one gray thermal image appeared in a mini window, and nothing else changed after that. Did it break?

Nope.  That's exactly what's supposed to happen. You can stop the sketch.

Here's what the sketch does.  It reads each tiny gray BMP image, enlarges and smooths the pixels with bilinear interpolation, colors the image from a palette of 256, and saves it in the data folder as a new 8-bit BMP file with the new color scheme.  The folder should now contain twice as many BMP files as before.

Modifying the Colors

Have a look at some of those new BMP images.  If the color palette doesn't work for you, ConvertBMPto8bit has other options.  Look for these lines in the Processing window.

// "paletteChoice" selects a false color palette:
// 0 == Grayscale, white hot
// 1 == Ironbow
// 2 == Firebow
// 3 == Hot alarm
// 4 == Grayscale, black hot
int paletteChoice = 1;

The last line sets the variable paletteChoice to 1, but four other options are available.  Two are grayscales, one is a dark-to-light gradient in warm tones, and "Hot alarm" is a light-to-dark grayscale that switches to a red-yellow highlight at the top, emphasizing the hottest colors.  Try different values for the variable and see which colors you prefer.

Coders familiar with Processing can even modify the function named loadColorTable() and generate their own custom palettes.

Once you're happy with your new BMP images, they can be uploaded to an online GIF creating site like, where they can be assembled into a motion GIF, and tweaked for size, speed, compression, and special effects.  Then you can send or post your hot motion images.  Dazzle your friends with your thermal fire dance moves!

Using ConvertBMPtoSeq01

Here's where your thermal images get all science-y. Creating time-based graphs and statistics in colorful motion, ready for detailed examination, it makes me feel like Mister Spock.

You know the drill by now, right? Open the sketch and paste your downloaded BMPs into its data folder before running. You got it. This time the images flash by in the graphical window as the sketch does its job. What's it doing? It's enlarging and coloring the images as before, then placing numbers and graphs around them for added coolness.

This sketch, unlike the others, can't process just one BMP file. Two is the minimum. Also, random files that aren't from a recorded sequence don't turn out well. You can try them, but they produce tangled graphs.

As each image appears, it gets saved as a JPG file in the sketch folder, (not in the data folder but alongside it). The sequence of source BMPs yields a sequence of JPGs.  The sketch freezes at the end of the sequence with the last image visible.  You may then stop the sketch (but don't close it yet).

Open one of the mov#####.jpg files in an image viewer and look it over.  The lines and colors carry real information about the temperatures in your pictures, but let's make them into a QuickTime movie next, and take a closer look afterward.

Images into Movies

The Processing language has a QuickTime movie maker in its collection of tools.  You can open it by finding it under the Tools menu.  This brings up an interface window.  Here's one that shows the settings I used for the handprint movie.

The directions don't recommend using a JPG sequence as a source for creating QuickTimes, but I do so anyway, and I find the quality acceptable. You can modify the sketch to output TIFF or PNG images if you want. You be the judge.

In the interface box there's a text field where the path of the folder holding the JPG images is selected. The path to your sketch folder is what goes there, and you can use the Choose... button to find it. The other options are yours to try. See what works best for you.

When you're ready, click Create movie..., enter a name for the file, and watch it work. (The movie you create may end up with a TMP file alongside it. It's no longer needed, and you can trash it.)  When finished, a QuickTime player can open your new movie and show it in glorious motion.  You're a thermal cinematographer!

Digging the Data

A QuickTime player can easily present the movie one frame at a time for closer inspection.  This is where those extra bytes added to each recorded BMP deliver their information.  Pause your movie on an interesting frame and take another look.

There's the colorized image to the right of the column of numeric values, and below them are two graphs, a basic value over time graph and a histogram.

The three number values colored red/gold/blue show our three favorite temperatures, the hottest/center/coldest for each frame.  The graph shows how those values were changing over time. Six small dots mark the highest and lowest points on each line, and a brief gray box will highlight the number at each moment when a dot is reached. This makes finding the hottest or coldest thing in your movie easy to do.

The histogram shows the population count of the 8-bit pixel values in the image, and the most populous pixel value gets converted back into a temperature and overprinted on the graph. The whole thing is auto-scaled so no values go off the charts. (Saying that readings are "off the charts" sounds so dramatic. Sorry about disallowing this.)

Modify Your Movies

ConvertBMPtoSeq01 has a small chunk of code near the beginning much like the one described earlier.  It allows different false-color palettes to be used for color output, just like ConvertBMPto8bit.

// Change the following values to customize the output images.
// "paletteChoice" selects a false color palette:
// 0 == Grayscale, white hot
// 1 == Ironbow
// 2 == Firebow
// 3 == Hot alarm
// 4 == Grayscale, black hot
int paletteChoice = 1;
boolean markersVisible = true, celsiusFlag = false, lirpSmoothing = true;

The three Boolean values that come next can also modify your output.  The options can hide the green crosses marking the extreme pixels, display the temperatures in Celsius, and disable the bilinear smoothing of the image pixels.

Above this code block are even more predefined values you could change, values that control the positions of various elements in the images.  You could define your own arrangement of the onscreen data display, if you wish.  The world of thermal movies is yours to explore!

This guide was first published on Mar 27, 2020. It was last updated on Mar 27, 2020.

This page (Putting It in Motion) was last updated on May 10, 2021.

Text editor powered by tinymce.