Page 1 of 1

possible bug -sparse-color after IM 6.7.6.9 Q16

Posted: 2012-08-18T12:02:14-07:00
by fmw42
Mac OSX Snow Leopard

I have not been able to get -sparse color to accept colors defined with % starting at IM 6.7.6.10 through the current version IM 6.7.9.0 It works fine for older versions such as 6.7.6.9 and 6.7.4.10


pcolor="white"
pcolor2="rgb(25.0004%,25.0004%,25.0004%)"
convert -size 100x100 xc:black -sparse-color barycentric "0,0 $pcolor 100,100 $pcolor2" 1tmp1.png

The error is:

convert: unknown image property "%," @ warning/property.c/InterpretImageProperties/3046.
convert: unknown image property "%)" @ warning/property.c/InterpretImageProperties/3046.
convert: unknown image property "%," @ warning/property.c/InterpretImageProperties/3046.
convert: unknown image property "%)" @ warning/property.c/InterpretImageProperties/3046.

It also fails for srgb colors defined with %
pcolor2="srgb(25.0004%,25.0004%,25.0004%)"

Re: possible bug -sparse-color after IM 6.7.6.9 Q16

Posted: 2012-08-18T13:42:07-07:00
by magick
Trying escaping the percents (e.g. rgb(25.0004%%,25.0004%%,25.0004%%)). Alternatively, Anthony could enhance the parser to handle both interpreted properties (e.g. %w) and colors with percentages.

Re: possible bug -sparse-color after IM 6.7.6.9 Q16

Posted: 2012-08-18T14:07:04-07:00
by fmw42
magick wrote:Trying escaping the percents (e.g. rgb(25.0004%%,25.0004%%,25.0004%%)). Alternatively, Anthony could enhance the parser to handle both interpreted properties (e.g. %w) and colors with percentages.
Thanks. That fixed it.

Re: possible bug -sparse-color after IM 6.7.6.9 Q16

Posted: 2012-08-19T19:55:23-07:00
by anthony
It should be only converting percent escapes when a number did NOT proceed it! This was to allow backward compatibility with Geometry Argumants. That is the percent in the above should be actual percents, and not percent escapes.

Ohh.... This is IMv6.. that 'percent' fix was IMv7!

IMv6...

Code: Select all

>>> convert rose: -print "srgb(25.0004%,25.0004%,25.0004%)  %w %h\n" null: 
srgb(25.000425.000425.0004  70 46
convert: unknown image property "%," @ warning/property.c/InterpretImageProperties/3056.
convert: unknown image property "%)" @ warning/property.c/InterpretImageProperties/3056.
convert: unknown image property "%," @ warning/property.c/InterpretImageProperties/3056.
convert: unknown image property "%)" @ warning/property.c/InterpretImageProperties/3056.
IMv7

Code: Select all

>>>  magick null: -print "srgb(25.0004%,25.0004%,25.0004%)  %w %h\n" null: 
srgb(25.0004%,25.0004%,25.0004%) 70 46 
As such to me this is fixed.. However I can backport that little bit of (not an escape if a number preceeded) code if you want.

Re: possible bug -sparse-color after IM 6.7.6.9 Q16

Posted: 2012-08-19T20:38:22-07:00
by fmw42
anthony wrote: However I can backport that little bit of (not an escape if a number preceeded) code if you want.
If not too much trouble, please do. That way I do not have to modify scripts to double quote when using/converting colors from [pixel:...]

Thanks.

Re: possible bug -sparse-color after IM 6.7.6.9 Q16

Posted: 2012-08-19T20:41:37-07:00
by anthony
I'll take a look at it tonight.


UPDATE -- 12 hours later --- Uploaded patch to SVN

Basically if % is after a number single letter escape will not be allowed...

EG: 100%x30 rgb(100%,100%,100%,.5)
will all be unchanged..

BUT if followed by a [ That is %[...] that will still be done...
As such 100%[x]30 will substitute the %x even though the % is after a number.

ADDENDUM.
Note that the use of %[x] for single character escapes was only added a few months ago, as part of this change in IMv7. It was at the same time the warning messages you see in the above examples was added. Before this time unknown percent substitutions would just silently fail, making debugging a lot harder.

Also a few other unusual escapes are provided, specifically: \n \r \% < > &
But only those escapes, at least at this time.


QUESTION: I probably should also ignore single letter % escapes if the escape is not followed by a letter or '[' or '%' chars, but the warnings do make it clear what is going on, so I will leave it for now.