craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.21k stars 624 forks source link

Craft3: Resizing transparent PNG create "dirty" transparency #1801

Closed hiasl closed 7 years ago

hiasl commented 7 years ago

Description

When we try to resize a PNG with parts (or all) of the image being transparent, the resized image does not have a clean transparent background, instead it somehow "dirty" This happens happens both with GD and with Imagick and various different transformation settings. OS is a current Ubuntu Xenial.

Steps to reproduce

  1. Upload our sample image (see attachment) logo_before_resize
  2. Integrate it into a template with getUrl('yourResizeHere'). Settings: Crop, PNG, 500 × 210, any quality
  3. Take a detailed look at the generated image (and/or see second attachment) logo_after_resize

Additional info

PHP version 7.1.6-1~ubuntu16.04.1+deb.sury.org+1 Database driver & version MySQL 5.7.18-0ubuntu0.16.04.1 Image driver & version Imagick 3.4.3, ImageMagick 6.8.9-9 Craft edition & version Craft Pro 3.0.0-beta.19

angrybrad commented 7 years ago

Curious if you see this behavior on Craft 2 on the same box.

brandonkelly commented 7 years ago

😐

hiasl commented 7 years ago

OK, seemed to be a caching issue on my side. The problem ist the GD library, not Craft3 vs 2:

I setup 3 clean test systems: Craft2 with imagick: http://craft2.von.gd/ Craft3 with imagick: http://craft3.von.gd/ Craft3 with GD: http://craft3-gd.von.gd/

Only the GD Version has the dirty background problem. Still interesting to know.

andris-sevcenko commented 7 years ago

I'm just going to sulk at GD. Again.