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

Re: possible bug histogram IM 6.7.6.9 Q16

Post by anthony »

fmw42 wrote:
What is wanted (needed) is for -resize '50%' to continue to work as it has always done, but also allow users to do -resize '%[my:percentage]%%' where 'my:percentage' is a pre-calculated user defined setting.
please explain the need for %% at the end and what does that become under windows?

Nothing about windows.

The %% is because the % is not following a number so if you want a percent to be present, either include it in the previous setting that ws saved, or double up or backslash the percent. For Windows, backslash would probably work better, as it likes to use percents for its own handling.

for example follow this example...
magick logo: -set 'my:percentage' '%[fx:(w>h?30:50)]' -resize '%[my:percentage]%%' logo.png

width larger than height, so 'my:percentage' is assigned a value of '30' (settings are strings not numbers). The resize then gets '50%' the %[...] substitution and the %% becomes just % (or you'll get a unknown image property warning)

Remember % is not following a number, so IM will try to expand it, and fail, producing a warning.


NOTE this 'number' rule is only in IMv7, not IMv6, as only IMv7 will be expanding in Geometry arguments.
But the rest of the changes is in IMv6 (as they are backward compatible).


%[type] for truecolor, grayscale, truecolormatte (or perhaps in IM7 truecoloralpha?) etc
There is a lot of confusion about the escapes... 'r', 'channels', 'colorspace', 'opaque'
especially since the introduciton of sRGB, which ruins the 'channels' escape!

I will be making these actually return what they say, and adding things like 'class' (which is what you are requesting)

I have copious notes about this. I will also be adding 'gray', whcih checks is all colors are grayscale. I am also trying to document those settings that may require a lot of calculation, such as: 'opaque' 'mean' 'max' 'min' 'skewness' etc...

I will also add %[if:{condition}:{then}:{else}] where the {...} themselves can contain escape sequences.
and where condition is on any string (or %[fx:..] expression) that is not an empty string, '0', or 'false'
so you will be able to DIY it in ImageMagick!

Note that while you can use -set compose, to set a per-image compose setting (for -flatten) you can not actually read back what the per-image compose setting is!!! I have a table of what is 'set-able' and what are 'escapes'.

The worse appears to be 'page' which has completely different meanings when setting (virtual canvas) and when reading (image index +1) for some strange reason! Aligning the known set names with known escapes is a high priority. Known as in attributes or meta-data, as opposed to 'free form' settings that are simply stored strings for later use.

%[alpha] to test if alpha exists as a channel (separate from %[channels]) (I see %A does that, so perhaps %[alpha] is not needed)
As you say '%A' does that, but having %[alpha] as a known read-only setting is also a good idea.
%[im_version] as 06070609 (this is different from %[version], which does not seem to be working)
Nice idea But for this small number how about %v It would be a great addition -- thanks.

On my list is 'lib_version' which is the library version number (which is a number like '0x676' But does not contain the minor number. See

Code: Select all

convert -list configure | grep LIB_VERSION
%[first_min_location] x,y location of first min pixel
%[first_max_location] x,y location of first max pixel
%[last_min_location] x,y location of last min pixel
%[last_max_location] x,y location of last max pixel
hmmm that may not be useful for further IM processing, unless you can separate two comma separated numbers without having to do that recalculation a second time! I'll note it as a suggestion. It would be useful If the mechnices can be worked out. It would be most usefull with gray images.

However what about the first 'west' location and first 'east' location :-)

I think something more general purpose may be better, rather than a specifically hardcored 'read-only' setting.

For example an operator that does the search, and saves all the various statistical results as properties. A bit like how a 'best-fit' label: returned the pointsize of the label it created as a properity 'label:pointsize'
http://www.imagemagick.org/Usage/text/#label_bestfit

That general routine can generate settings for min, max, standard-deviation, positions, north,south,east,west bounds (of a threshold?), and do it all in the one pass though the image!

This can also replace many of the current 'calculated now' settings that are present. And it will be expandable.
functions exist, but better ways of using is needed.


Think about it and let me know what you come up with!
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 histogram IM 6.7.6.9 Q16

Post by fmw42 »

or example follow this example...
magick logo: -set 'my:percentage' '%[fx:(w>h?30:50)]' -resize '%[my:percentage]%%' logo.png

width larger than height, so 'my:percentage' is assigned a value of '30' (settings are strings not numbers). The resize then gets '50%' the %[...] substitution and the %% becomes just % (or you'll get a unknown image property warning)
Don't you mean that if w>h your get 30, which is then the value that resize uses and not 50

With respect to min and max locations, often one is looking for those coords to use as is. So I think it would be good. But if you want to use directions, that is ok, but then you still need one set for min and one set for max.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug histogram IM 6.7.6.9 Q16

Post by fmw42 »

With regard to my original issue, the following seems to be working now in IM 6.7.6.10 beta

convert 1rose1.gif -format %c histogram:info:

The output now shows on the terminal.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: possible bug histogram IM 6.7.6.9 Q16

Post by anthony »

fmw42 wrote:
or example follow this example...
magick logo: -set 'my:percentage' '%[fx:(w>h?30:50)]' -resize '%[my:percentage]%%' logo.png

width larger than height, so 'my:percentage' is assigned a value of '30' (settings are strings not numbers). The resize then gets '50%' the %[...] substitution and the %% becomes just % (or you'll get a unknown image property warning)
Don't you mean that if w>h your get 30, which is then the value that resize uses and not 50
Sorry, yes. I have the above implemented (but not debugged so not yet submited) and yes it is a value of '30'.
With respect to min and max locations, often one is looking for those coords to use as is. So I think it would be good. But if you want to use directions, that is ok, but then you still need one set for min and one set for max.
I agree, and I'll look at it as I make the various sub-functions of "compare" available in "magick".
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: possible bug histogram IM 6.7.6.9 Q16

Post by anthony »

fmw42 wrote:With regard to my original issue, the following seems to be working now in IM 6.7.6.10 beta

convert 1rose1.gif -format %c histogram:info:

The output now shows on the terminal.

Good!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply