Scale-to-Gray Technology

<< Click to Display Table of Contents >>

Navigation:  Programming Techniques > Pictures >

Scale-to-Gray Technology

Previous pageReturn to chapter overviewNext page

[Professional Edition and above]

A high resolution image (with for example 300 or 600 DPI) scaled down to the screen preview (which is usually a 96 DPI device) is looking bad due to the nature of the scaling algorithm. The reason is that pixels are left out when drawing such a high resolution image to the screen.

Example:

If you draw a 300 DPI image to a 96 DPI screen, the image is scaled down by a factor of 96 / 300 = 0.32. This means, only 32% of all pixels are drawn, the rest is left out. (i.e. after each pixel that is drawn, 2 pixels are left out)

What the Scale-to-Gray Technology does:

The Scale-to-Gray Technology is especially useful for displaying forms on the screen, because a grayscale image is scaled down to the low screen resolution, while the loss of visual information (the pixels that are left out) is transformed to gray-values of different intensity (brightness). This produces perfect readability for the human eye.

Additionally, together with the Scale-to-Gray Technology you can use two different images for the same page: one for the screen (preview) in low resolution, and one for printing in the original high resolution. Therefore you gain perfect readability on the screen as well as on the printouts.

 

Example, normal scaled image:

Scale2Gray Unscaled

 

Example, image scaled with Scale-To-Gray Technology:

Scale2Gray Scaled

 

Souce Code Example:

NoPen()

 

// Insert original image on page 1:

Picture(0, 0, VFREE, VFREE, "..\\images\\gew300g4.tif")

PageBreak()

 

// Insert the scaled images now invisible for printing:

SetPrintable(FALSE)

 

// PIC_SCALE2GRAY is the choice, if you need best readability only for a 1:1

// Preview Scaling. The scaled image is only computed once and then held in

// the dynamic cache (if the property PictureCache is set to true, which is

// the recommended default).

// This gives the best balance between required CPU time and memory usage.

// The scaled image will only be re-computed, if it falls out of the dynamic

// cache and needs to be re-created from file again.

PictureScale2Gray = true

Picture(0, 0, VFREE, VFREE, "..\\images\\gew300g4.tif")

PageBreak()

 

// The floating Scale-to-Gray image is computed each time when it is

// displayed. Setting PictureScale2GrayFloat will disable Scale2Gray

// and vice versa.

PictureScale2GrayFloat = true

Picture(0, 0, VFREE, VFREE, "..\\images\\gew300g4.tif")

 

// Insert the high resolution images now invisibly for previewing, but

// visible for printing:

PictureScale2GrayFloat = false

SetPrintable(TRUE)

SetViewable(FALSE)

GotoPage(2)

Picture(0, 0, VFREE, VFREE, "..\\images\\gew300g4.tif")

GotoPage(3)

Picture(hDoc, 0, 0, VFREE, VFREE, "..\\images\\gew300g4.tif")

Note that the four images in the document share only ONE "gew300g4.tif" image in memory. The four images that share one memory-image are: The three high resolution images and the PIC_SCALE2GRAY_FLOAT image (which uses the original "gew300g4.tif" to compute the grayscale image from it).