Composition of alpha channels fails on 6.9.1-2

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
janpecha
Posts: 3
Joined: 2017-10-18T01:16:39-07:00
Authentication code: 1151

Composition of alpha channels fails on 6.9.1-2

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Composition of alpha channels fails on 6.9.1-2

Post by snibgo »

What is "COMPOSITE_DEFAULT"? Is it the same as "Over"?
snibgo's IM pages: im.snibgo.com
janpecha
Posts: 3
Joined: 2017-10-18T01:16:39-07:00
Authentication code: 1151

Re: Composition of alpha channels fails on 6.9.1-2

Post by janpecha »

Yes, it is same as "Over".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Composition of alpha channels fails on 6.9.1-2

Post 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.
janpecha
Posts: 3
Joined: 2017-10-18T01:16:39-07:00
Authentication code: 1151

Re: Composition of alpha channels fails on 6.9.1-2

Post by janpecha »

Ok, thanks.
Post Reply