globocom/thumbor — pull request #227 by igorsobreira (2013-12-03 21:16:03+00:00)
Title: Keep transparency when saving image on P mode

Hello,

I commented on issue #136 a problem I had when converting a transparent gif to png, it would turn the background black instead of keeping the transparency.

I found a solution to my problem, unfortunately not generic enough to fix the issue (not sure if it's that much related after all, I should have opened a new issue).

This change fixes my problem, I also tested animated gifs to make sure I didn't broken them. But I'm not an expert on PIL or images modes and conversion in general, so I appreciate any code review, more testing for other cases, suggestions to make the solution more generic.

The tests pass but I didn't add any more tests. Do you have any test that actually modifies images and checks the metadata for results, or something like that? I couldn't find a place to add a test for this change.

Thanks, hope to get this fix to start using in prod! :)