ImageMan DLL Suite Version 8Submit feedback on this topic   

Scaling Monochrome Images

ImageMan has full support for antialiased scaling of black and white images, what is commonly referred to as  scale-to-gray. Antialiasing can only be used when shrinking a monochrome image, but it produces stunningly superior results.

 

The trick to antialiasing is to use shades of gray in the new, smaller image to represent a given area from the original image. Of course, you can't have shades of gray in a monochrome image  there's only black or white  so ImageMan actually creates a 16-color or 256-color image to represent the scaled version of the original monochrome image.

 

To use antialiasing when shrinking a monochrome image, simply pass the COPY_ANTIALIAS (for a 16-color resulting image) or COPY_ANTIALIAS256 flag (for a 256-color resulting image) to the ImgCopy function. In general, 16 levels of gray is adequate for most images, so you should use the COPY_ANTIALIAS flag unless you have a specific need for a 256-color result.

 

Here's an example of scaling an image using both methods:

 

// In this example, the source image must be larger than

// the destination, which will be 100 x 100 pixels.

//

// Create a 16-level grayscale image

hImage2 = ImgCopy(hImage, 100, 100, NULL, COPY_ANTIALIAS)

//

// Create a 256-level grayscale image

hImage2 = ImgCopy(hImage, 100, 100, NULL, COPY_ANTIALIAS256)

 

 

 


© 1995-2004 Data Techniques, Inc. All rights reserved.