Written on 03 Jan 2023

How to turn a directory full of images into an animated GIF

I used ImageMagick and a a daily image published by NOAA to look at 2022's soil moisture.

It's been raining a lot here in Sacramento and soil moisture is something people are talking to each other about. It's weird. And wet.

Last January I started a "git scraping" repo to collect images that the National Weather Service publishes everyday of "calculated" soil moisture across the lower 48 and wanted to animate them together in sequence. No real reason, just wanted to see 2022 measured by wet dirt.

Here's the animated GIF, by the way:

An animated amp of the lower 48 US states where each frame is a sequential day in 2022, starting with Jan 17, 2022 and ending on January 2, 2023.

The scraper puts all of the images in a single directory and names them in the format of YYYY-MM-DD-soil-moisture-mm-daily.gif. Even though it has a .gif file extension these source images aren't animated at all. I'm just choosing to keep the source file extension used by NOAA.

I ran the convert command installed by ImageMagick from within the images directory and out came the animated GIF you see above.

convert -loop 0 *-soil-moisture-mm-daily.gif soil-moisture-mm-daily.gif