Image Manipulation – Resizing an Image with Non-Integral Conversion Factor

image manipulation

I'm resizing an image based on a non-integral conversion factor (a bmp image, in fact). I understand how resizing works, just non with a decimal number. For instance, if the factor were 2, I would simply write the individual pixels twice to the output file. You can't really write 1.5 pixels if the factor were, say, 1.5. Conceptually, how might this play out?

Best Answer

Don't think of the process as "where would this pixel go?", but rather as "from where did that pixel came?".

Then, it's easy to see that each pixel in the final picture will come from a position at a fractional coordinates in the original image, that just means it will have a color that is a weighted average of the near pixels.

That's why Photoshop (and others) lets you choose the subsampling algorithm. Some are prettier but use more origin pixels, or need more precise math, while others are fast and doable with integer numbers but not so good looking.

Related Topic