Forum Archive

images2gif crashes...

Webmaster4o

My version of images2gif crashes whenever I use writeGif in the latest beta. Anyone else have problems? readGif works fine. Problem with the new app sandbox?

EDIT: the two other versions I can find online (this one and this one) also crash when using writeGif.

omz

I've noticed that as well. Not sure yet why this happens, but I'll look into it.

Webmaster4o

I've just been doing testing. The crash occurs in the line images2.append( im.convert('P', palette=AD, dither=dither) ). Further testing reveals this is because of the pallet argument. Any time I run im.convert('P', pallet=Image.ADAPTIVE) I get a crash. Running without the pallet argument works.

Webmaster4o

You also get a crash with, say,

from PIL import Image

i = Image.new('RGB', (100,100), (255,0,0))
p = i.convert('P',palette=Image.ADAPTIVE) #crashes

Image.ADAPTIVE appears to be equal to one, which is strange to me. If I put in one for palette, it crashes. If I put in zero or two, it's fine.

i.convert('P', palette=0)#works
i.convert('P', palette=1)#crashes
i.convert('P', palette=2)#works
I.convert('P', palette=525632)#works fine
Webmaster4o

Is this fixable?

omz

I sure hope so. :) Thanks for the additional details!

I haven't had time to look into this yet, but as this is a regression (worked in previous builds), I'm optimistic that it's fixable, and it's on my list of "critical bugs that need to be fixed before release".

I'm thinking about replacing PIL with Pillow while I'm at it, not sure yet if that's going to work out.

Webmaster4o

Oh wow. From what I'd heard, PIL is a mess and pillow is considered the stable release. Surprised we weren't on pillow. I don't think it'd be hard to make the change.

Webmaster4o

I see in the latest build you have not only replaced PIL with Pillow, but also made images2gif a core module! :)

omz

Alright, I've replaced PIL with Pillow in build 160033, seems to be working well, crashes are gone for me.

For some reason, I couldn't get the images2gif version you were using to work – it doesn't crash, but there's an exception I don't understand completely. However, I've bundled a working version with the new build (writing animated GIFs seems like a thing that Pythonista should support out of the box), so you could just remove yours.

omz

Oh, you're faster than me. :)

Webmaster4o

:) yeah.