2

I have several png images that when transformed from png to jpg, the alpha layer is transformed to an horizontally lined pattern.

Therefore I have to keep them as png, wich is in my case unnecessary and a drastic data load issue.

The problem appears in production, wich is an ArcusTech server.

Anyone knows what it could be ?

Thanks !

3
  • 1
    Are you using GD or Imagick on the server? Also, alpha is transparency which is not supported by jpg. What exactly are you expecting here? Apr 5, 2017 at 11:48
  • Ooooh I've looked into the installed dependencies on my prod, and only GD is installed. As Craft stands: "GD or ImageMagick is required, however ImageMagick is recommended as it adds animated GIF support, and preserves 8-bit and 24-bit PNGs during image transforms.". I asked the ArcusTech team to install it since it could be the issue :-) Usually, alpha layers in png are replaced by plain colors in jpg (and generally plain white) as it does on my local. Thanks already !
    – Antoine
    Apr 5, 2017 at 14:18
  • As Brad pointed out below, let's see how Imagick handles this. Should be much better. Apr 6, 2017 at 6:16

1 Answer 1

1

You'll need to have Imagick installed on your box if you want to preserve alpha channels in a PNG during transforms.

If Craft sees it is installed, it will use it by default.

4
  • Thanks for your input ! Imagick is now installed and, surprisingly, the transform alpha layers of my jpgs-transformed-from-pngs are now black and not white as it is on my local
    – Antoine
    Apr 6, 2017 at 10:15
  • Are you running a newish version? imagemagick.org/script/changelog.php and pecl.php.net/package-changelog.php?package=imagick
    – Brad Bell
    Apr 6, 2017 at 18:18
  • Nope :-/ imagick module version 3.4.0RC6 imagick classes Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel Imagick compiled with ImageMagick version ImageMagick 6.8.9-9 Q16 x86_64
    – Antoine
    Apr 10, 2017 at 15:57
  • Maybe try updating those and see if it helps.
    – Brad Bell
    Apr 10, 2017 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.