# Image resizing and interpolation

In digital image processing, I need to understand what does image resizing do? Does it only change the dimensions of the image, for example, from 256×256 to 128×128 with the same pixel spacing (the same dpi)? Or does it change the dpi or pixel spacing in an image? If I need to increase the size of the image and also increase its dpi, how can I do this?

In digital image processing, an image resizing changes only the array size (dimensions) of the image. It does not care about dpi. It just upsamples or downsamples the image array.

DPI (Dot Per Inch) is considered only when the actual physical size of the displayed (or printed) image is of concern.

When you display a scaled image on the same physical monitor, then the apparent dpi of the image content will be changing too. This is especially important on text processing with font rendering.

Some programs try to keep image physical display size the same, while scaling them or when displayed on different monitors, by incorporating a dpi parameter to be used as well.

[edit for answer below] In those examples from Gonzalez's book, images are considered with their physical sizes when displayed (or printed). Assuming square pixels, DPI of a physical display device is computed by $$\text{DPI} = \frac{ \text{ number of horizontal pixels on the monitor}}{ \text{ horizontal length (in inches) of the monitor}}$$

for example for a typical 15.6 inches, FHD (1920 x 1080 ), 16:9 aspect ratio laptop, the DPI will be $$\text{DPI} = \frac{ 1920 \times \sqrt{16^2 + 9^2}}{15.6 \times 16} = 141.212$$

That's the DPI of the monitor.

Physical size of a displayed image with a array size of $$M \times N$$ is given by $$\text{H} = \frac{ M }{ \text{DPI}}$$ horizontally and

$$\text{W} = \frac{ N }{ \text{DPI}}$$ vertically in inches...

For amonitor with a given DPI, an image with smaller array size $$M,N$$ will display smaller on the screen. If you upsample (aka interpolate, or scale) the image array from $$M,n$$ to, say, $$3M, 3N$$, then the displayed image size will also be tripled.

And finally; interpolation of an image (or any digital data) means computing the sigal values that's physically in between its existing samples. In that respect you are decreasing the pixel distance when you interpolate. However, interpolation will not give you new data; it will only make exsting data smoother. That's exacty why you cannot get authentic FHD video simply by interpolating from an SD original source...

@Fat32 : In the reference Digital Image Processing (third edition) authored by Rafael C. Gonzalez and Richard E. Woods, I have read the following paragraph in subsection 2.4.3 Spatial and Intensity Resolution: Figure 2.20 shows the effect of spatial resolution in an image. The images in Fig. 2.20 (a) through (d) are shown in 1250, 300, 150, and 72 dpi, respectively. Naturally the lower resolution images are smaller than the original. For example, the original image is of size 3692 x 2812 pixels, but the 72 dpi image is an array of size 213 x 162. In order to facilitate comparisons, all the smaller images were zoomed back to the original size (the method used for zooming is discussed in subsection 2.4.4).

Thus, I have also read the following paragraph in subsection 2.4.4 Image Interpolation: Fundamentally, interpolation is the process of using known data to estimate values at unknown locations. We begin the discussion of this topic with a simple example. Suppose that an image of size 500 x 500 pixels has to be enlarged to 750 x 750 pixels. A simple way to visualize zooming is to create an imaginary 750 x 750 grid with the same pixel spacing as the original, and then shrink it so that it fits exactly over the original image. Obviously, the pixel spacing in the shrunken 750 x 750 grid will be less than the pixel spacing in the original image. To perform intensity level assignment for any point in the overlay, we look for its closest pixel in the original image and assign the intensity of that pixel to the new pixel in the 750 x 750 grid. When are finished assigning intensities to all the points in the overlay grid, we expand it to the original specified size to obtain the zoomed image. This called nearest neighbor interpolation.

Why do we need to change the pixel spacing when applying interpolation? I think interpolation is considered with finding missing pixel values when getting images with different dimensions but with the same pixel spacing. I would be grateful if you could help me understanding and solving this conflict.

• Hi! is this an "answer" or a very long "comment" to my answer ? – Fat32 Dec 13 '19 at 19:51
• Please do not post follow-on questions as answers. Answers are supposed to actually be answers to the original question, not discussion. It's just not the StackExchange Way. Either ask for clarifications in comments, or edit your question to include the material in this post. – TimWescott Dec 13 '19 at 20:02