Color Table Manipulation Methods

When a new image is created, a temporary color table is created with it. If the image is an 8-bit indexed image (the default behavior), the color table will be limited to 256 colors. If the image is truecolor, you can add as many colors as you want to the color table (you can think of the color table as more of a color library, if that helps).

GD provides a number of methods for retrieving information about an image’s color table and for manipulating entries in the table. In addition, several special color constants can be used to implement different-shaped brushes and line styles.

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.