Chapter Contents

Previous

Next
DITHER

DITHER



Dithers an image to a color map


Syntax
Details
Example

Syntax

rc=IMGOP(task-id, 'DITHER'<, option>);
region-id=PICFILL(graphenv-id, type, ulr, ulc,
lrr, lrc, source<, 'DITHER'<, arguments>>);

option
specifies which color searching algorithm to use. Each algorithm searches the color map at a different speed. You can specify FS_NORMAL, FS_FAST, FS_FASTER, or FS_FASTEST. If you specify FS_NORMAL, then SCL exhaustively searches the color map for the closest match. FS_FAST, FS_FASTER, and FS_FASTEST each use a progressively faster searching algorithm. These algorithms will find a close color match but not the closest. Usually, a close match is sufficient. The faster the search, the less accurate the color match might be. The default option is FS_FASTEST.


Details

DITHER acts on the currently selected image. It dithers an image to the current color map: the one specified by a previous GENERATE_CMAP, STANDARD_CMAP, or GRAB_CMAP command.

Like the MAP_COLORS command, DITHER reduces the number of colors in an image. Unlike the MAP_COLORS command, DITHER attempts to choose colors by looking at pixels in groups, not as single pixels, and tries to choose groups that will result in the appropriate color. This is similar to the half-toning algorithm that print vendors use to show multiple colors with the use of only four ink colors. This command is much more computationally expensive than the other color-reduction commands, but it handles continuous-tone images much better.


Example

Dither an image:

if (dither=1) then
   do;
      rc=imgop(task-id,'GENERATE_CMAP','COLORRAMP',
               5,5,4);
      rc=imgop(task-id,'DITHER');
      rc=imgop(task-id,'PASTE');
   end;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.