A report by Georg Petschnigg, June 2002
![]() |
![]() |
| Bicubic Filtering Blurred Edges |
ClearScale Sharper Edges |
Digital Camera's are selling like hotcakes and the image quality has been improving by leaps and bounds. Going cameras generate high-resolution images with over 3.5 Million Pixels, for more than a typical LCD monitor can display. Resizing is needed, which begs the question on how to do this best a low resolution LCD monitor? One idea is ClearScale presented here. This utility, inspired by Microsoft ClearType®, takes advantage of an LCD monitor's discreet Red, Green and Blue stripes and resizes images with sub pixel accuracy.
Note: This report has to be viewed on an RGB order LCD display
BackgroundIn recent years ClearType and related technologies have received a lot of hype. If you are unfamiliar with ClearType read a marketing description here and if your are more technically inclined the research version here. Indeed ClearType has improved the readability of text on LCD displays. Despite marketing claims it does not increase the "actual" resolution of display. ClearType exploits the human eye's desire to see continuous lines (spatial acuity) and its limited ability to perceive local color changes. It generates the appearance of higher resolution, by trading off color shifts for the appearance of a smooth edge. In this project I explored applying a ClearType like resampling algorithm to natural images.
Implementation DetailsThe general idea behind ClearScale is to resize an image three times as wide as desired, and then decimate the RGB values using a linear interpolation function. The algorithm works as follows.
1. Resample image to NewHeight by 3 * NewWidth using correct pre-filtering
and a bi-cubic interpolation kernel.
In my implentation I used
GDI+, Microsoft's standard imaging library, which accomplishes this via SetInterpolationMode(InterpolationModeHighQualityBicubic)
and DrawImage(). See sample code and details for this resizing operation at
MSDN.
![]() |
| This is the original input image at 600 by 450 which we want
to scale down to 200 by 150 |
![]() |
| Image resized to 600 by 150 - now we have to perform a decimation in RGB |
2. RGB decimate
The next step is to decimate the wide image in RGB. For each output pixel's
color component three input pixels are averaged. For example to generate the first
output pixel's R component, the R component of input pixels 0,1 and 2 are averaged.
Then the output's G component is constructed the same way by sampling the pixel locations
one over (1,2,3). Blue is generated using 2,3,4 and so on. Please refer to the diagram
below for a detailed visualization.
![]() |
| Each output pixel is generate by displaced sampled R, G, and B components |
One design parameter is how to assign the weights in the averaging filter. In the extreme case only the center pixel is used, which will generate the "sharpest" image but may introduce color shifts. This can be used for images with few hard edges. To avoid visible color artifacts the filter weights should be equal. The ClearScale utility lets you specify how much you actually want to weight the center pixel. As a default I weight the center pixel twice as much as its neighbors. Border pixels are handled by pixel replication.
The result of RGB decimation is an image of size NewHeight by NewWidth.
To gain further insight into RGB decimation I generated a 3000 by 3000 large
sin(x^2 + y^2) zoneplate. A zoneplate is a bunch of concentric circles that are
spaced closer and closer as the distance from the center increases (see image below).
I resized this image to 180 by 180 pixels and looked at the aliasing artifacts.
![]() |
![]() |
![]() |
![]() |
| Cropped input Zone Plate | Bicubic interpolation with correct pre-filtering shows little aliasing | ClearScale with no filtering in the RGB decimation shows color aliasing | ClearScale with correct prefiltering shows little color aliasing but a crisper looking core |
The reference image was generated using the pre-filtering bicubic mentioned above.
It shows very faint signs of aliasing at twice the the Nyquest frequency. For
all practical purposes these effects do not show up in a natural image
Applying ClearScale without filtering in RGB decimation leads to colored aliasing
artifact as can be seen in the image above. While this may look bad in a zoneplate,
these colorings actually may not be visible in certain images.
See the flowers above. Without pre-filtering the effects of
ClearScale are most pronounced and yield the sharpest appearance.
The final image in the sequence shows ClearScale with correct filtering. Like in
the reference image , few signs of aliasing are visible. The inner core looks crisper and extends further in the horizontal direction in which ClearScale
was applied.
Finally I compared my implemented algorithm against fonts rendered with ClearType.
For this I rendered fonts six times as wide as tall without anti-aliasing. I then
used ClearScale to resize the font image to a unit ratio. Another approach would have
been to use anti-aliased fonts three times as wide as tall, but this yielded fonts
that looked blurry in the vertical direction (incidentally ClearType does not smooth
fonts in the vertical direction as well which can be seen in the "~" sign).
The only
major difference I found in my images was that the letter "a" and "e"
which where filled
in different ways for the 6pt font. This can be explained by the fact that I used
Adobe PhotoShop to render the fonts and not GDI+, Microsoft's font engine.

Please go to the results gallery here.
Overall I found that the technique developed by Microsoft works well for images.
Font smoothing still remains the sweet spot for displaced filtering. Still there
are a few key applications in which displace filtering should be used for natural
images on LCD:
Conceivably this work could be extended into other domains as well:
The key lessons learned where:
Limitations:
Why not try it yourself? Download ClearScale and give it a whirl on your favorite image. ClearScale works with TIF, PNG, JPG and BMP images. ClearScale requires GDI+ Microsoft's fancy imaging library.
Download and unzip ClearScale into your directory of choice and run ClearScale
from the command prompt.
Usage Instructions:
clearscale.exe imagname.jpg
then follow the program prompts.
For more control control you may specify the following parameters:
clearscale.exe <imagenam> <weight 0 - 100> <width> <height>
Where weight controls specifies the weight of the center pixel in the
averaging operation. The default is 66%, no aliasing occurs at 33%, if the image
has many colors 100% can be used.
BUG: You must included a weight if you specify new image dimensions.
Copyright © 2002 Georg Petschnigg