Color and Transparency

Of the color methods, the Quantize( ) and Map( ) functions are the most immediately useful for adjusting the number of colors in an image and synchronizing the color maps of different indexed images. Use the Transparent( ) or MatteFloodfill( ) methods to add transparency to an image with an alpha channel. (ImageMagick uses the terms “matte” and “transparent” interchangeably.)

Certain of the attributes in Table 3-5 (the component primary points and rendering_intent, for example) are really advanced colorimetry options and are not generally used unless you are working in the specialized area of color profiling. See the International Color Consortium’s ICC Profile Format Specification at http://www.color.org for more information on color profiles and colorimetry.

Table 3-5. Color and transparency attributes

Attribute

Read

Write

Description

background

Yes

Yes

Sets or returns the background color of an image. Remember that for a GIF multi-image sequence, every image is sized by default to the size of the largest image; the background color fills the remaining space.

bordercolor

Yes

Yes

The bordercolor attribute is used in functions such as Rotate( ) and Shear( ) where an image is transformed and “empty” background spaces are created that should be distinct from the background color.

blue_primary

Yes

Yes

Returns the chromaticity blue primary point. This is a color management option. Set the value with 'x_value,y_value'.

class

Yes

No

A Direct class image is of continuous tone and is stored ...

Get Perl Graphics Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.