Gifthermal.c

You may be familiar with pngthermal, the program that generates a heatmap-like representation of a PNG file's compression efficiency.
I thought it would be fun to try to make a gif version of pngthermal, since I'm an unofficial GIF expert and I made that GIF library in Python.
But after making a gifthermal in Python, I realized it was really slow, so I decided to try to learn C to make a faster version; I'd heard C is pretty fast.

I guess I made gifthermal, a C program now. Compile it with a C compiler! (warning: probably kinda kludgy)

The colours gifthermal outputs are copied from pngthermal:

ColourMeaning
#000560<1 bit per pixel
#023D9A<2 bits/pixel
#005FD3<3 bits/pixel
#0186C0<4 bits/pixel
#4AB03D<5 bits/pixel
#B5D000<6 bits/pixel
#EBD109<7 bits/pixel
#FBA70F<8 bits/pixel
#EE0000<9 bits/pixel
#D00000<10 bits/pixel
#B20000<11 bits/pixel
#950000<12 bits/pixel
#77000012 bits/pixel (GIF can't have over 12 bits/pixel)

If a GIF image is interlaced, gifthermal will remove the interlacing, which is what pngthermal does. There's a comment in the source explaining how to make gifthermal keep the interlacing, if desired.

C is super wacky. As someone with mostly experience in JavaScript, I can see a lot of similarities between C and JavaScript. Even some between C and Python, as if Python took the names of some of C's functions.
C also has things that seem really messy and confusing to me with no experience in C. I feel reminded of when I had just started programming and spent more time debugging code than writing code.

If anyone attempts to make a jpgthermal or such, good luck! Especially with the image formats where the pixels can't neatly be mapped to a number of bits; those sound really challenging.