Page 1 of 1

Colorizing by convert with gradient fails - version problem?

Posted: 2014-09-05T05:42:20-07:00
by iwrbf
Hi,

if been running a script on a php5 linux server (old Ubuntu 10.04 LTS) with an imagemagick version of:

Code: Select all

Version: ImageMagick 6.5.7-8 2012-08-17 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
Features: OpenMP
Now I recently moved the script on another server with this version:

Code: Select all

Version: ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
The whole setup is quite unchanged.

I do a call on the imagemagick functions by php's exec() like this:

$hexr=sprintf("%02X",($clr_d['r']));
$hexg=sprintf("%02X",($clr_d['g']));
$hexb=sprintf("%02X",($clr_d['b']));

$ex="convert -size 1x6 gradient:'#".$hexr.$hexg.$hexb."'-'#".$hexr.$hexg.$hexb."' ".$sym_dir."colornow.png";
exec($ex,$out);

$ex="convert ".$sym_dir.$v2_links."_links.png ".$sym_dir."colornow.png -clut ".$sym_dir."tmp.png";
exec ($ex,$out);

The script works as "colorizer" for a symbol which is then merged with a picture.

It worked flawlessly until moving the whole thing on the new server.Now, the color is _always_ purple - which is... unwanted at best ;-)

Values in variables are the same, only thing I can think of is some change with the versions? If not, I stand corrected, but I'm out of options after trying to fix this thing for many hours now :-(

Kind regards,
Peter

Re: Colorizing by convert with gradient fails - version prob

Posted: 2014-09-05T06:06:30-07:00
by snibgo
I don't have either of those versions, but trying some others around the same vintage shows no problems.

The commands look okay, but you might print out the values of $ex and $out.

Re: Colorizing by convert with gradient fails - version prob

Posted: 2014-09-05T06:56:40-07:00
by iwrbf
Hi,

thank you for your time!

The resulting commands in the exec commands ($ex) are:

convert -size 1x6 gradient:'#FFFF00'-'#FFFF00' /home/site/pics/symbolonlay/colornow.png

and

convert /home/site/pics/symbolonlay/symbol_left.png /home/site/pics/symbolonlay/colornow.png -clut /home/site/pics/symbolonlay/tmp.png

The #ffff00 is used to produce pure yellow, which worked... until moving the stuff to the other server... *shrug*

$out is an empty array in both cases, no problems, no error messages...

Kind regards,
Peter

PS: The flawed picture after listening to "purple rain" on a one song shuffle for a loooong time... ;-)

Image

Re: Colorizing by convert with gradient fails - version prob

Posted: 2014-09-05T07:30:15-07:00
by snibgo
Hmmm, weird. You might try dumping the values in the gradient file:

Code: Select all

convert /home/site/pics/symbolonlay/colornow.png txt:

# ImageMagick pixel enumeration: 1,6,255,srgb
0,0: (255,255,0)  #FFFF00  yellow
0,1: (255,255,0)  #FFFF00  yellow
0,2: (255,255,0)  #FFFF00  yellow
0,3: (255,255,0)  #FFFF00  yellow
0,4: (255,255,0)  #FFFF00  yellow
0,5: (255,255,0)  #FFFF00  yellow

Re: Colorizing by convert with gradient fails - version prob

Posted: 2014-09-05T07:36:01-07:00
by iwrbf
I've tried the text dump, yet. No change, still purple... :-(

Re: Colorizing by convert with gradient fails - version prob

Posted: 2014-09-05T07:52:29-07:00
by iwrbf
iwrbf wrote:I've tried the text dump, yet. No change, still purple... :-(
Mea culpa, I got your last post completely wrong.

Manual dumping into a txt file results in:

Code: Select all

 convert colornow.png txt:
# ImageMagick pixel enumeration: 1,6,65535,srgb
0,0: (35466,11051,58082)  #8A8A2B2BE2E2  BlueViolet
0,1: (35466,11051,58082)  #8A8A2B2BE2E2  BlueViolet
0,2: (35466,11051,58082)  #8A8A2B2BE2E2  BlueViolet
0,3: (35466,11051,58082)  #8A8A2B2BE2E2  BlueViolet
0,4: (35466,11051,58082)  #8A8A2B2BE2E2  BlueViolet
0,5: (35466,11051,58082)  #8A8A2B2BE2E2  BlueViolet
So the problem is in the grad file, I guess? any ideas why it creates a blueviolet entry when pure yellow is given?

Re: Colorizing by convert with gradient fails - version prob

Posted: 2014-09-05T07:54:01-07:00
by snibgo
If you put /home/site/pics/symbolonlay/symbol_left.png somewhere, I can download it and try the commands on various versions of IM.

This might not tell us much, as it could be a bug in just v6.7.7-10.

Re: Colorizing by convert with gradient fails - version prob

Posted: 2014-09-05T07:59:46-07:00
by snibgo
You edited while I was posting.

You have narrowed down the problem. It isn't in the clut, but the gradient. Try:

Code: Select all

convert -size 1x6 gradient:'#FFFF00'-'#FFFF00' /home/site/pics/symbolonlay/colornow.png
convert -size 1x6 gradient:#FFFF00-#FFFF00 /home/site/pics/symbolonlay/colornow.png
convert -size 1x6 gradient:yellow-yellow /home/site/pics/symbolonlay/colornow.png
(The 2nd version has no quote characters.)

Re: Colorizing by convert with gradient fails - version prob

Posted: 2014-09-05T08:00:14-07:00
by iwrbf
Okay... I f****cked the whole thing up. SORRY FOR WASTING YOUR TIME!

The whole site was copied via rsync which changed UGO on the temporary grad file. This together with a cruelly paranoid setup did just... nothing. The grad file was not changed.

Okay, I'm feeling like Homer Simpson now, sorry again. One should think of something this obvious before blaming ImageMagick and wasting days of one's time (and yours!)

Kind regards and many thanks,

Peter-who's-now-off-for-a-beer-and-some-hitting-his-head-on-a-table...