Page 1 of 1

Strange black bars

Posted: 2017-09-09T12:07:20-07:00
by himowa
Hello! First time posting here so please let me know if you need more info. I am running Imagemagick 7.0.7 on my Centos server with Imagick PHP 3.4.3. I recently upgraded from an outdated version when doing a server migration and now code that works just fine produces strange black bars.

Here is an example, normally the image would be just a white alligator. The code I have written recolors certain image layers and then composites them together to form one image with various colors.

Re: Strange black bars

Posted: 2017-09-11T11:49:50-07:00
by fmw42
Have you tried doing your command in equivalent command line mode? Does it fail that way? Did 7.0.7 come with CENTOS or did you install it? Is PHP 3.4.3 and Imagick compatible with IM 7? Have you tried using IM 6 and Imagick? What is your minor version of 7.0.7.x? How did you install it? If from source, then did you install all the needed delegates for various image formats? Is there a simple code example that reproduces the issue?

Re: Strange black bars

Posted: 2017-11-03T12:57:26-07:00
by himowa
Hey thanks for replying and sorry for the delay in responding back! I'll do my best to answer your questions but please bare with me, I am a novice at working with IM especially from the command line.

I was able to composite layers in the command line without encountering the bug, but I was unable to figure out how to replicate the recolor process in this way. However, running a similar script in PHP without recoloring produces no bars, so the issue is definitely with the recolor!

7.0.7 was installed by the company that hosts the server. I requested the most up-to-date version.

I really don't know, how can I check this?

IM 6 and Imagick had a different bug that prevented me from retaining the alpha shape of an image while recoloring, prompting me to request an upgrade. Though it seems IM7 also doesn't recolor properly.

ImageMagick 7.0.7-0 Q16 x86_64 2017-09-07

I am unsure how exactly it was installed, as it was installed by the server admins.

Here's the function I use to recolor, which seems to be the section that is causing the bug. The intended purpose is to recolor the image with a flat color hex and retain the shape/alpha of the image.

Code: Select all

protected function recolor($obj, $hex)
    $obj->setImageBackgroundColor('#' . str_replace('#', '', $hex));
    return $obj;

Re: Strange black bars

Posted: 2017-11-03T13:32:49-07:00
by fmw42
Your same code is discussed here: Does setImageBackgroundColor permit hex colors and have you provide that with the correct syntax? Try putting in a specific hex color and see if that works rather than a variable for $hex. Does your version of Imagick support IM 7?