ImageMan ActiveX
Using the Image Processing Features

Using the Image Processing Features
The image control supports many image-processing features. Support for these features is implemented via methods, making it easy to develop sophisticated applications in very little time.

 

Rotation of images is accomplished by invoking the Rotate method with the number of counter-clockwise degrees the image should be rotated. The amount of rotation is specified in hundredths of degrees so to rotate an image by 22.5 degrees you need to pass (36000 - 2250) to the Rotate method. Each time the method is invoked, the image will be rotated by the specified number of degrees.

 

Flipping or mirroring the image is done by invoking the MirrorVertical or MirrorHorizontal methods.

 

An image's brightness is adjusted using the Brightness method. Setting the brightness parameter to a value between 1 and 255 will brighten the image, while setting it to a value between -1 and -255 will darken the image.

 

Gamma adjustments to an image are made using the Gamma method. Allowable values for this property are 1.0 to 5.0.

 

An image can be converted to an image with fewer colors by using the DitherMethod property and ReduceTo method. The DitherMethod property specifies which dithering algorithm will be used when converting the image. The allowable values are:

 

0 - No Dither


1 -  Bayer Dither


2 -  Burkes Dither


3 -  Floyd Steinberg Dither


 

The no-dither option results in the fastest image conversion but the poorest image quality. The Bayer dither is very fast but generally yields average results. For best image quality use either the Burkes or Floyd Steinberg dithers.

 

The process of reducing the colors is accomplished by invoking the ReduceTo method. When calling the method you can specify the number of colors the image is to be reduced to, whether the image should be converted to grayscale and whether an optimized palette should be used.

 

The following code loads a 24-bit image and reduces it to a 256 image with an optimized palette using the Burkes Dither.

 

ImageControl1.Picture = "24bit.tga"

ImageControl1.DitherMethod = 2

ImageControl1.ReduceTo 256, FALSE, TRUE

' Now draw the new image

ImageControl1.Refresh

 

The IncreaseTo method is used to increase the color depth of an image. It is invoked with a parameter that indicates the bit depth that the image should be increased to.

 

 


© 2014 Data Techniques, Inc. All rights reserved.

Submit feedback on this topic