Re: possible bug histogram IM 6.7.6.9 Q16
Posted: 2012-05-14T22:15:30-07:00
fmw42 wrote:please explain the need for %% at the end and what does that become under windows?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.
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).
There is a lot of confusion about the escapes... 'r', 'channels', 'colorspace', 'opaque'%[type] for truecolor, grayscale, truecolormatte (or perhaps in IM7 truecoloralpha?) etc
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.
As you say '%A' does that, but having %[alpha] as a known read-only setting is also a good idea.%[alpha] to test if alpha exists as a channel (separate from %[channels]) (I see %A does that, so perhaps %[alpha] is not needed)
Nice idea But for this small number how about %v It would be a great addition -- thanks.%[im_version] as 06070609 (this is different from %[version], which does not seem to be working)
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
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.%[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
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!