Page 1 of 1

Composition of alpha channels fails on 6.9.1-2

Posted: 2017-10-18T02:08:34-07:00
by janpecha
Hello.

I have this PHP code (simplified):

Code: Select all

$back = new Imagick;
$back->newImage(400, 400, new ImagickPixel('#FFEEEEBB'));
$back->setColorSpace(Imagick::COLORSPACE_SRGB);
$back->setOption('png:color-type', 6);
$back->setImageFormat('png32');

$scale = 0.45;
$front = new Imagick;
$front->setBackgroundColor(new ImagickPixel('transparent'));
$front->readImage(__DIR__ . '/source.png');
$front->transformImageColorspace(Imagick::COLORSPACE_SRGB);
$front->setImageFormat('png32');
$front->resizeImage($front->getImageWidth() * $scale, $front->getImageHeight() * $scale, Imagick::FILTER_LANCZOS, 1, 0);

$back->compositeImage($front, Imagick::COMPOSITE_DEFAULT, 50, 50);
It loads logo and places it to partictly transparent background image. On localhost it produces expected result, but on hosting it fails.

Logo:
Image

Expected result:
Image

Current result:
Image

Localhost
imagick module version: 3.4.3
Imagick compiled with ImageMagick version: ImageMagick 6.8.9-9 Q16 x86_64 2017-03-12
Imagick using ImageMagick library version: ImageMagick 6.8.9-9 Q16 x86_64 2017-03-12

Hosting
imagick module version: 3.4.3RC1
Imagick compiled with ImageMagick version: ImageMagick 6.9.1-2 Q16 x86_64 2015-05-21
Imagick using ImageMagick library version: ImageMagick 6.9.1-2 Q16 x86_64 2015-05-21

I think it is bug in ImageMagick 6.9.1-2.

Any idea how to fix it? I can't update ImageMagick to newer version because hosting is not mine :(

Many thanks for help!

---

Maybe same problem: https://www.imagemagick.org/discourse-s ... hp?t=27683

Re: Composition of alpha channels fails on 6.9.1-2

Posted: 2017-10-18T03:27:52-07:00
by snibgo
What is "COMPOSITE_DEFAULT"? Is it the same as "Over"?

Re: Composition of alpha channels fails on 6.9.1-2

Posted: 2017-10-18T05:40:40-07:00
by janpecha
Yes, it is same as "Over".

Re: Composition of alpha channels fails on 6.9.1-2

Posted: 2017-10-18T15:31:32-07:00
by fmw42
Definitely a bug in IM 6.9.1.2. I can reproduce it in command line for that version and it works properly in the current 6.9.9.20. I have found no easy way to fix the issue in 6.9.1.2.

Re: Composition of alpha channels fails on 6.9.1-2

Posted: 2017-10-18T23:58:01-07:00
by janpecha
Ok, thanks.