Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
6.x-1.3 doesn't work correctly when resizing GIF images that contain transparent pixels.
6.x-1.2 worked fine, and therefore I'm left wondering why the imagealphablending and imagesavealpha functions are now used for all images and not just for PNGs (also see issue #355242). :3
Here's a test case:
http://i43.tinypic.com/beep2r.gif (Original transparent GIF image)
http://i41.tinypic.com/ngrn1d.gif (Scaled down to 150x150 using imageapi 6.x-1.3)
http://i44.tinypic.com/5zmw6s.gif (Scaled down to 150x150 using imageapi 6.x-1.3 with the attached patch applied)
Comment | File | Size | Author |
---|---|---|---|
#10 | origin.gif | 2.82 KB | yang_yi_cn |
#10 | before.gif | 1.68 KB | yang_yi_cn |
#10 | after.gif | 1.05 KB | yang_yi_cn |
#9 | 373590-imageapi-gd-gif-transparency.patch | 595 bytes | yang_yi_cn |
#6 | imagecache_transparency_test.png | 377.85 KB | dman |
Comments
Comment #1
foutrelis CreditAttribution: foutrelis commentedIssue linking fail. Here's a correct link: #355242: Transparency fixes for imageapi - GD
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedI'm having the same problem with gifs, but applying the patch gives me the same broken but still transparent image as the previous version of imageapi.
Comment #3
drewish CreditAttribution: drewish commentedwe've got some good code that's been committed to D7 HEAD that needs to be backported. once it's all in HEAD i'll work on this.
Comment #4
dman CreditAttribution: dman commentedsubscribe (sorry no time now, but I'll see next time I'l playing with trans :( )
Comment #5
drewish CreditAttribution: drewish commentedI committed #396924: Backport fixes from D7 core which should help with this. If not please re-open this issue.
Comment #6
dman CreditAttribution: dman commentedI just did a big round of testing (and subsequent changes to my imagecache actions) and it seems like todays D6 dev is looking really good for transparencies.
Still a small issue with gifs on resize - as you can see in the third row. That happens because a gif with #FFFFFF and #FFFFFF+Alpha is a legal gif (those are two different indexed colors) but when the image gets copied to a new resource, that becomes : (both are white, and white is transparent)
Meh.
Often we can work around that by using an off-white (or "that pink") to be the transparent color (row 4) - but that has unpleasant results.
Still, mostly good. Gifs are not very popular targets for imagecache ... I imagine?
Not re-opening, it's fixed enough until I can really find a need to push it harder.
Comment #7
drewish CreditAttribution: drewish commentedi'd be all for fixing this but at this point we need to corrdinate the fix with core so that it and imageapi stay consistent. make sure you ping me when you open a new issue.
Comment #9
yang_yi_cn CreditAttribution: yang_yi_cn commentedI meet some problem with GD & scaled gif images today.
After some research, I found that post http://www.letsgeek.com/code/resize-transparent-gif-in-gd-php/ , which mentioned that you have to use imagecreate() instead of imagecreatetruecolor() for gif images, to make the transparency work correctly.
And it works for me. The patch is being attached.
Comment #10
yang_yi_cn CreditAttribution: yang_yi_cn commentedalso my images are attached:
Origin / before patch / after patch