possible bug -sparse-color after IM 6.7.6.9 Q16

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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

possible bug -sparse-color after IM 6.7.6.9 Q16

Post 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%)"
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

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

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

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

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply