Custom cheer bits - Wrong extension/file type

Alright, so I’m working on a small minigame which creates bits in the game based on cheering.
To test this out, I started using the image url’s I get from https://api.twitch.tv/kraken/bits/actions.
All of them seemed to work out fine. At this point I used the static .png’s.

Then I encountered issues with the custom cheermotes. Apparently, the image downloads as a .png. Opening this in paint/paint dot net, works fine. However, when trying to load them in my program, it didn’t want to load. Same for photoshop. Apparently. The image which downloaded with file extension: “.png”. But internally is a gif. So basically the file extension is just changed. Not the actual file type.

A static kappa image from “api.twitch.tv/kraken/bits/actions”: https://d3aqoihi2n8ty8.cloudfront.net/actions/kappa/dark/static/1/4.png
This one works perfectly fine. File extension is a .png, actual file type is a .png.

A static custom cheermote from there: https://d3aqoihi2n8ty8.cloudfront.net/partner-actions/106744619/64e21259-b22f-4133-8993-460845feef4c/10000/light/static/4/22fd5f744276d4cd36b4e71f8a8577f6ce5407ad.png
This one has file extension .png, but internally is a .gif.

Is this done intentional? Or is this a bug? It seems like a nasty bug to me.

The API provides both animated and static URLs in the response. The static assets are PNGs and the animated assets are GIFs. I’m on a Mac, but I can download and open the two files above in GIMP, Photoshop CC, Preview, and a web browser. Curious if you’re seeing errors on all PNGs or not.

I understood that. I can open all normal png’s without any issues. So the first png (the static kappa png), loads just fine. However the second one doesn’t want to load. Tried it using Photoshop CS6 and CC 2015. It’ll say: Could not complete your request because the file-format module cannot parse the file. Renaming the image to an extension with gif instead of png, will allow it to load correctly in photoshop, and also Unity (which I use for the development). I used an online tool which allows me to check the file type, and it actually says the file type is a .gif. (even though the file extension says .png).

The signature on the PNGs and GIFs from the custom Cheermote APIs are equivalent to a GIF. Chrome and whatnot will display the content anyways because they can still understand something even if the file extension is wrong.

Extension | Signature
----------|---------------------------
PNG       | 89 50 4E 47 0D 0A 1A 0A
GIF       | 47 49 46 38 39 61

Any custom Cheermote PNG that I check has the GIF signature. Since the PNGs are generated from the first frame on the uploaded GIF, they’re simply set as a PNG extension but not actually encoded as such.

1 Like

So why have they done this? It seems like a dirty thing to me. Why don’t they keep the file extension .gif? Or actually encode it to .png?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.