How Image Resizing Works And How To Magnify Images Without Significant Quality Loss

How Image Resizing Works And How To Magnify Images Without Significant Quality Loss

by Gary Oldwood on 31 May 2017 · 4301 views

Image processing is one of the most common things a user is required to perform, either for professional or personal purposes. Most users, therefore, know that magnifying an image has a loss of quality, making it look blurry and pixelated. However, there are several methods that minimize the photo’s distortion and quality loss.

Computer graphics

Before moving into the methods for magnifying an image decreasing quality, however, we will refer to the types of computer graphics that exist today.

Those who are not interested in technical details can jump directly to the techniques section.

Raster graphics

Bitmap images, or raster graphics, are formed by a set of pixels. Whenever you take a photo or store an image in the well-known jpeg or png formats, these are raster images.

If you magnify a raster image enough, then you can clearly distinguish the pixels that comprise the image.

1 large How Image Resizing Works And How To Magnify Images Without Significant Quality Loss

Vector graphics

In the case of vector graphics, things are much different. Images of this kind of graphics are not made up from pixels, but instead they are comprised of lines, polygons, and more generally by mathematical operations.

Simply put, every shape in a vector image is represented by points and coordinates. In the following figure you can clearly see the differences between the two types of graphics.

2 full How Image Resizing Works And How To Magnify Images Without Significant Quality Loss

Therefore, no matter how much you are magnifying a vector graphics image, there will be no loss of quality. The computer will recalculate the new size each time based on the given coordinates and formulas.

A typical example of vector graphics is the fonts used on the computer and mobile devices in general. No matter how large the letters are, the corners of the letters remain smooth without producing any pixelated effect.

Why do raster images get pixelated when zooming in?

First of all, it must be clarified that the loss of information is certain whenever you perform any resizing on the image.

However, the quality loss is not as obvious when zooming out as it is when zooming in an image, and this is due to pixels. With the following images we will try to explain what happens when resizing a bitmap image. Let's start from a very simple shape.

3 full How Image Resizing Works And How To Magnify Images Without Significant Quality Loss

If you try to resize the above image and make it smaller, the result will be the following:

4 full How Image Resizing Works And How To Magnify Images Without Significant Quality Loss

As you can see, there is no obvious quality loss on the image.

However, the original image is 400x400 pixels, which means that it has a total of 160,000 pixels. The smaller image is 200x200 pixels, that is, 40,000 pixels in total.

So, although you cannot see it, the smaller image lost 120,000 pixels, which is 75% of its original information.

Let’s enlarge the original image.

6 full How Image Resizing Works And How To Magnify Images Without Significant Quality Loss

Here it can be observed that the shape is blurred, and the corners of the letters are no longer as crisp as they used to be. The new image size is 600x600 pixels, equal to 360,000 in total.

When zooming out, the computer needed to get rid of some pixels to create the desired size. On the other hand, when magnifying the image, the computer was forced to create 200,000 new pixels to add to the original image, "guessing" their color based on the original pixels.

The addition of the new pixels is performed with several algorithms which are mentioned below, and as you can see, image deformation is inevitable.

Algorithms for magnifying photos

In order to zoom in properly, one is required to use an image editor. This can be either Windows Paint, or alternatively, a more sophisticated, professional software with more features.

For example, let's say that you wish to double the size of an image that has an original size of 5x5 pixels.

7 full How Image Resizing Works And How To Magnify Images Without Significant Quality Loss

During this process, the original pixels are kept, and the program is asked to find a way to color the new pixels that will be created.

8 full How Image Resizing Works And How To Magnify Images Without Significant Quality Loss

For this purpose, various algorithms have been created, calculating the color of a new pixel based on its neighbors. More advanced programs, like Photoshop, have multiple algorithms for resizing images. The most popular ones are:

Nearest Neighbor: This one is the simplest method. Upon magnification, the algorithm replaces each pixel with multiple pixels of the same color. However, the result produces the "aliasing" phenomenon, in which the rows of the image look like small stairs. This is what we call pixalation.

Bilinear: A color interpolation method is used to compute the color value of a pixel, taking into account the color values of adjacent pixels. This algorithm can significantly reduce the contrast of an image, resulting into the final image being blurred.

Bicubic: It's similar to Bilinear, but has a better quality control over the details. In very bright spots it can produce a clipping effect, in which the pixels become completely white. However, with this effect the lines can look clearer, which may be desirable, depending on the image.

The most common software usually include all three of the above algorithms. Other programs may have additional features, such as the Lanczos, B-spline, and Mitchell algorithms.

And this is the end of the technical part of the guide. If you wish to learn more details, in this page you can see a detailed description of some algorithms, as well as their effect on image resizing. Additionally, this article on Wikipedia has a great comparison gallery for image scaling algorithms.

Techniques for better quality during photo magnification

As we described already, if the photo you wish to magnify is a raster graphics image and not a vector graphics image, then the loss of quality is given. There is no way to create a larger version of the same image and maintain 100% of the original quality.

However, the human eye is not exactly known for its extreme accuracy, thus it can be tricked with different techniques so that the loss of quality will be unnoticeable.

Never magnify an image more than 300%

When it comes to medium and large-sized photos, the magnification of up to 200% is not apparent. Up to that point, the result will be quite satisfactory.

9 large How Image Resizing Works And How To Magnify Images Without Significant Quality Loss

Depending on the image, you may try reaching 300% as well.

However, it’s recommended that no further magnification is performed from that point on. At 300%, the photo looks a lot more blurry, and can only get worse.

10 large How Image Resizing Works And How To Magnify Images Without Significant Quality Loss

In any case, however, you should experiment and choose at what size you consider your image to look good.

The larger the original image, the better

The size of the original image is of great importance when it comes to resizing. If your original image is too small, even slight magnification will have significant quality loss. On the other hand, if your image is already large (e.g. over 1000x1000px) then the quality loss during magnification will not be particularly noticeable.

Sharpening

If the software you’re using has a sharpening filter, then it can have better results during resizing. More advanced image editors have several sharpening filters, which can be useful for different occasions.

12 large How Image Resizing Works And How To Magnify Images Without Significant Quality Loss

A Sharper Scaling

There are several applications that promise to make photo resizing easy, fast, and above all, maintain original quality.

All of these programs use one of the common algorithms mentioned above, and then add various filters (sharpening, noise reduction, etc.) to make the photo seemingly better.

An experienced Photoshop (or other professional image editing software) user is able to add the proper filters manually, achieving the best result possible.

However, most users do not have such knowledge, so we’ll need something easier and automated, something like A Sharper Scaling. The application is free and seems to produce quite decent results with the automated settings for magnification.

Installation and usage

To download the software, visit its page and click on Download. Download3k mirrors are also available.

13 full How Image Resizing Works And How To Magnify Images Without Significant Quality Loss

After downloading the installer, open it and follow the setup wizard. The installation procedure is pretty straightforward and easy.

Using the software is quite simple. To load an image, you can either paste one from the clipboard, open one from the local folders on your computer, and open several ones for batch processing.

14 large How Image Resizing Works And How To Magnify Images Without Significant Quality Loss

Then all you have to do is enter the desired dimensions into the Target size or Scaling fields and click OK. This will display a preview of the image.

15 full How Image Resizing Works And How To Magnify Images Without Significant Quality Loss

From there, you can either copy the image to the clipboard, or save it to a folder.

Above the image preview you can select a different method to use when resizing, and see which one produces the best results for the given image.

16 large How Image Resizing Works And How To Magnify Images Without Significant Quality Loss

So, that’s how resizing works, and how you can enlarge an image while minimizing quality loss. If you have any tips, suggestions or thoughts, let us know in the comments section below!

Comments (0)
Featured Articles