Name

Map( ) — choose a set of colors from another image

Synopsis

$image->Map(image=>image-object,
               dither=>{1, 0})

Map( ) will change the colormap of the image to that of the image given as a parameter. This may be used to “synchronize” the colormaps of different images, or used with the special “Netscape” template format to convert an image’s colormap to the 216-color web safe palette:

$websafe = Image::Magick->new;
$status = $websafe->Read('NETSCAPE:');
$image->Map(image=>$websafe, dither=1);      # dither to 216-color cube

Get Programming Web Graphics with Perl and GNU Softwar 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.