Image scaling without interpolation


Two reason to scale grayscale image without interpolation:

  • intepolation add new color in image
  • .net GDI mechanism can’t return image in 8 bits – pixel format

Demo project

When a image is scaled with a scaling factor greater then 1, the image get black pixels,
to fill black pixels exist 3 well known algorithms

  • Nearest neighbor
  • Bilinear
  • Bicubic

all 3 algorithms add new color in image

Idea of scalig iamge without interpolation is:

  • to create an temprorary image with dimension computed with scaling factor
  • in temporary image will be a group of pixels for evry pixel from original image
  • to scale temporary image to target image that is small then target image; will get no black pixel when scaling with fator small than 1

With .net Bitmap object the SetPixel method does not work in image with indexed pixel format, shall to work with bitmap data.

The scaling factor for temporary image will be the smallest integer greater then target scaling factor

Create temporary image matrix
Temporary image never be a image, only a byte matrix that hold values of pixels

Compute scaling factor for temporary image to target image
Get scaling factor from division operation between target dimension and actual dimension

Fill target image pixel data scaling teporary image.
For evry pixel from temporary image get new index in target image using scaling factor

At the end set target image data and the color palette

Finally, there’s another very important peculiarity of what does Cialis that brings it so high above its alternatives. It is the only med that is available in two versions – one intended for use on as-needed basis and one intended for daily use. As you might know, Viagra and Levitra only come in the latter of these two forms and should be consumed shortly before expected sexual activity to ensure best effect. Daily Cialis, in its turn, contains low doses of Tadalafil, which allows to build its concentration up in your system gradually over time and maintain it on acceptable levels, which, consequently, makes it possible for you to enjoy sex at any moment without having to time it.

By continuing to use the site, you agree to the use of cookies. More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.