简体   繁体   中英

What is a “valid IM color”?

I found the following documentation in a bash script written for use with some software named, " imagemagick "

# USAGE: multicrop2 [-c coords] [-b bcolor] [more options, blah blah,...]
# [... snip ...]
# -b     bcolor        background color to use instead of option -c;
#                      any valid IM color; default is to use option -c

I cannot fathom what the code author considered to be a "valid IM color." I am guessing that "IM" is simply an abbreviation of "image," but perhaps "instant messaging," or something else was meant. What do you think?

A hex code for RGB would have blue in the lower byte, green in the middle byte, and red in the upper byte, but I am not sure whether they use standard RGB encoding for colors or not.

Multicrop2 is my script. A valid ImageMagick color is any color scheme that ImageMagick recognizes, such as rgb, hex, cmyk, hsl, and even color names in the format specified in its documentation and especially at http://www.imagemagick.org/script/color.php . There are too many to list in my script. Often I refer to this link, but apparently in this case I did not. But most ImageMagick users are aware of its typical color schemes. ImageMagick users mostly know that IM is an abbreviation for ImageMagick. Colors follow the CSS stye guide for the most part. Colors with #, spaces or parentheses, need to be quoted, at least on Unix-like systems. Color names do not need quoting. Apologies to newbies to my scripts and ImageMagick.

Examples:

rgb(255, 0, 0)                          range 0 - 255
rgba(255, 0, 0, 1.0)                    the same, with an explicit alpha value
rgb(100%, 0%, 0%)                       range 0.0% - 100.0%
rgba(100%, 0%, 0%, 1.0)                 the same, with an explicit alpha value
#ff0000                                 #rrggbb
#ff0000ff                               #rrggbbaa
gray50                                  near mid gray
gray(127)                               near mid gray
gray(50%)                               mid gray
graya(50%, 0.5)                         semi-transparent mid gray
hsb(120, 100%,  100%)                   full green in hsb
hsba(120, 100%,  100%,  1.0)            the same, with an alpha value of 1.0
hsb(120, 255,  255)                     full green in hsb
hsba(120, 255,  255,  1.0)              the same, with an alpha value of 1.0
hsl(120, 100%,  50%)                    full green in hsl
hsla(120, 100%,  50%,  1.0)             the same, with an alpha value of 1.0
hsl(120, 255,  127.5)                   full green in hsl
hsla(120, 255,  127.5,  1.0)            the same, with an alpha value of 1.0
cielab(62.253188, 23.950124, 48.410653)
icc-color(cmyk, 0.11, 0.48, 0.83, 0.00)  cymk
icc-color(rgb, 1, 0, 0)                  linear rgb
icc-color(rgb, red)                      linear rgb
icc-color(lineargray, 0.5)               linear gray
icc-color(srgb, 1, 0, 0)                 non-linear rgb
icc-color(srgb, red)                     non-linear rgb
icc-color(gray, 0.5)                     non-linear gray

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM