ImageMan ActiveX
Displaying True Color Images

Displaying True Color (24 Bit) images may require some extra code since some display drivers only support displaying a limited color set. When displaying a 24-bit image on one of these drivers, you must use the ReduceTo method and optionally the DitherMethod property to be able to display the picture with the proper colors. The DisplayColors property is also very useful since it returns the number of colors supported by the current video driver mode.

 

In order to properly display these images your code must check to see whether the current video driver is capable of displaying the number of colors in the image and it its not then calling the ReduceTo method to color reduce the image. The following code illustrates this:

 

' Load an Image and color reduce/dither it if it Contains more colors that the current video mode supports

' Make sure AutoDraw property is set to FALSE so we can Check the # of colors in the image before it is displayed

ImageControl1.GetFileName

ImageControl1.AutoDraw = False

If ImageControl1.ImageColors > ImageControl1.DisplayColors And _

ImageControl1.DisplayColors < 257 And ImageControl1.ImageFlags <> 1 Then

' Color reduces it to the color depth of the display

' Driver and use an optimized palette with Floyd-Steinberg Dithering

ImageControl1.DitherMethod = 3

ImageControl1.ReduceTo ImageControl1.DisplayColors, False, True

End If

ImageControl1.Refresh 

The DitherMethod property is used to specify what type of dithering is used when color reducing the image. For color images you should select either option 2 (Burkes) or option 3 (Floyd-Steinberg) dithering.

 

 


© 2014 Data Techniques, Inc. All rights reserved.

Submit feedback on this topic