Loading certain gifs as Imagetable prevent building

So I'm not sure if I should post this here, because it's hard to pinpoint where the issue lies.

I have fought with this issue since the beginning of the Playdate. Sometimes, an animated gif will cause Nova to refuse to build. I'll get a message saying that Nova caught an exception. Sometimes, the gif will look fine in other applications but look corrupted in Playdate once imported as an image table.
I tried everything and can't wrap my head around this. Sometimes all it takes is to crop the gif by one pixel, and save it again. Sometimes I'll bring a gif that has been exported by Aseprite, open it in Photoshop, overwrite it as a gif, and it'll work.
I'm at the end of my wits with this. Any insights would be really appreciated.

Is there any correlation between success and the image dimensions being a power of 2?

No.I thought about that but that doesnt seem like it. I couldn't find any rhyme or reason to it. I have kept 2 gifs that are in appearance exactly the same but one works and the other is mangled once imported. If someone smarter than me wants to investigate I'm happy to provide them.

Odd. Are they bit by bit identical?

Obviously not, or they wouldn’t behave differently. But the pixels in both gifs are exactly the same, on every frame. And both are exactly the same when opened in Photoshop or Aseprite. Only the Playdate SDK makes a difference.

Maybe the metadata has a character, or is longer that the PD asumes. Perhaps you could try manually editing the metadata of the one that doesn't work to bring it inline with the one that does work in the hope of finding what particular field is causing it.

it sounds like this is easy to reproduce, so if you could post some of these gifs or DM them to me I'd love to take a look!

DM files to you. Thank you!

1 Like

Thank you so much for kicking me in the butt on this! :slight_smile: There are a couple of issues in the tracker for this, dating back to 4 years ago, so it's been on my mind for a long time but not the highest priority because it's sort of obscure and there's an easy workaround. But I finally sat down last night and figured out the detail of animated gif "disposal methods" that I'd missed (in the clear-to-background mode, you only clear the area of the image the previous frame covered, not necessarily the entire image) and it's working correctly now.

Once we get our automated builds running again I'll post compiler builds here to test.

For the Mac build you'll probably have to remove the quarantine flag with sudo xattr -r -d com.apple.quarantine pdc. I don't know exactly which dlls the windows build uses and I have no way to test it so I threw in the ones that looked relevant. Let me know if it's not working!

pdc-macos.zip (763.7 KB)
pdc-linux.zip (249.3 KB)
pdc-windows.zip (689.0 KB)

That's awesome! Thank you, Dave. This fixed corrupted looking gifs and even one that was crashing the build. Nova built without complains, gif looking as it should.
Thank you very much for fixing this. I was bugged by this once in a while but could never figure what I was doing wrong.
This may help a lot of beginners who may gave ran into the issue as well.
I could only test the mac build as I don't own a PC, but at least the mac build fixed all my issues.
Cheers!

Stephan

1 Like

Great to hear it. Thanks for confirming the fix so quickly! :slight_smile:

Updated the builds with one more bug fix:

pdc-macos.zip (770.2 KB)
pdc-linux.zip (252.1 KB)
pdc-windows.zip (611.8 KB)

Thank you. Unfortunately I get a incompatible os from the simulator.
I'm on Ventura 13.6.9. Is my OS too old?

agh, sorry! I forgot to merge it back to 2.6.2. I'll get new builds up in a sec!

Edit: sorry, too much going on, thought I did this but I guess I spaced it. :frowning: I'll get builds up in the morning.

Here we go, 2.6.2 builds with the fix added. Sorry for the delay!

pdc-macos.zip (763.7 KB)
pdc-linux.zip (249.3 KB)
pdc-windows.zip (667.8 KB)

Thanks, Dave.
Unfortunately I'm sorry but this version seems to have an issue with displaying some image tables.
Check this example. The right behavio should have the arrow moving around, but the new version displays all the frames instead of refreshing the image
Right
Wrong

:person_facepalming: Would you mind sending me the animated gif here so I can figure out what's going on now (and add it to the test so it stays fixed)?

And oh my god this game looks incredible!

I'm tempting fate, didn't test all of the files you'd sent, found the bug with the first one I looked at and I'm assuming it's the same problem in all of them. It sure looks like the same problem.. Anyway, here's the latest. Find me another broken gif! I dare you!

pdc-macos.zip (763.7 KB)
pdc-linux.zip (249.3 KB)
pdc-windows.zip (667.9 KB)

Sorry for taking a bit long. So, as far as I can tell, everything works fine now! I built the game with that version and went over the whole game, and I couldn't find anything wrong. So looks like you've done it :slight_smile:
Now I can't speak for every gif out there but the ones I have don't show any issues.
I'll keep looking for any trouble, and I'll let you know if I find anything. Hopefully it's the last time.
Thank you very much for looking into this. This is very helpful!
Cheers