How I made and reshaped a GIF

Featured image

I needed to create a 6-second GIF overlaying different 🛰️ satellite images on top of another so it will be easier for me to present our work of satellite image analysis.

So I needed to:

Creating the GIF and executing all of the steps above is super simple in Ubuntu ➡️ by using ImageGick. This is how it goes

1. Choose all separate images

I decided that I wanted to take a look at the burnt area of the 2020 August Complex in California, U.S.A. Here is how the burned area is visualized by Wikipedia, for example:

2020 August Complex Burnt Area

Note: Find more imformation about all 2020 California fires here under the official fire department’s page.

I knew the area of the world I wanted to explore satellite images for, and then I visualized it in Sentinel hub. Sentinel Hub is a platform which allows for the easy discovery and visualization in the browser of satellite images coming from different providers, which makes it very handy to work with.

I chose to view images from Sentinel 2, which are two twin satellites - built by ESA, orbiting Earth and taking images of the reflectance of not only the visible light off the surface of the ground, but also of somethings which is invisible to the human eye - such as near-infrared light and short-wave infrared light.

I chose 4 different representations of the same satellite image taken on 24 September 2020, which show me the following:

I saved all of these images as screenshots - PNG images with resolution of 1920x108o pixels. 1920 is the width of the image, and 1080 - the height of the image (e.g. the image is 1080 pixels high).

2. Glue the images together to create the GIF

After I installed ImageGick on ubuntu, I opened the terminal, naviated to the folder in which I had saved my screenshots, and executed the following command:

convert -delay 1500 August_complex_True_Colour.png August_complex_SWIR.png August_complex_NDVI.png August_complex_Moisture.png August_complex_gif.gif
-delay - means how many miliseconds to wait before showing the next image
 August_complex_gif.gif - is the created GIF

the created GIF

3. Crop the GIF to custom dimensions

As you can see the top and left parts of the GIF above need cropping. This is how it was done:

convert August_complex.gif -coalesce -repage 0x0 -crop 1210x720+642+199 +repage output.gif

1210x720+642+199 - I needed to describe the coordinates of the top left pixel of the new GIF, which I choose as pixel at width 642 and height 199 of the original GIF. After the top left pixel was selected, I say to Imagemagick to create a new GIF with dimensions of 1210x720 pixels.

This is it 😊


Additional Reading

  1. StackOverFlow - How do I crop an naminated gif using Imagemagick