Graphics: interpolation to resize images with Gimp
Inspired by the comments to one of my old article, I write a brief guide to clarify any doubts on’graphic interpolation. The short article today will speak only interpolation from the point of view of the graphic software, but it must be noted that interpolation is first of all a method to identify new points on the Cartesian plane, starting from a set of data points in the hypothesis that all the points can refer to a function f(x) of a given family of functions of a real variable.
Taken from Wikipedia.
In scientific and technological activities, and generally in quantitative studies of any phenomenon, happens very often that you have a certain number of points in the plane obtained with a sampling or measuring devices, and to consider appropriate steps to identify a function that all data points or at least in their vicinity (see curve fitting).
In short, a set of data points seemingly random, with interpolation trying to determine the degree of randomness in the data points, and create new ones with the same degree of randomness. Many will be puzzled to see me bring this information on the mathematical, but the interpolation has to do with the graphics more than you suspect, and is called “antialias” (the antialiasing).
Take the case of having enlarge image. From a certain number of pixels, Related by their color and the next, the software will have look for other pixels to be placed at the beginning to optimize the image size according to user preference. Without using interpolation from the graph, the program would be visibly enlarged images aliased. The same process occurs when reduce the size of the. The graphics program will make a summary of the interesting points (usually takes into account the contrast) and remove part of the information.
The interpolation, however, is not a single procedure, there are different modes. In the screenshot below we see some available by default in Gimp. There are a few other, but these are the only ones included in the core of the Gimp.
The default choice is the “Cubic“, a powder’ most odious burden as the CPU, but it certainly offers the best yield.
- “No”: simply copies the original pixels in the surrounding spaces. And’ the easiest method, faster but less accurate. The final image will be noticeably jagged.
- “Linear”: calculates the average between the four neighboring pixels to the original. It offers a good compromise between performance and accuracy. This method is also called “Bilineare”.
- “Cubic”: calculates the average of the eight adjacent pixels. And’ certainly the slowest method, one that requires more computer work, but the result is better. It is also called “Bicubica”.
- “Sinc (Lanczos3)”: is the procedure that requires the greatest efforts to the CPU, uses the mathematical function of the sinc and the result is qualitatively the best.
Let us assume that our image is the following:
The following will double the size with the different interpolation methods.
Without too much explanation is clear to all the difference (is best perceived by opening a full screen picture), and keep in mind that those taken in the example are small images, defects are amplified easily. The same algorithms can be used for resizing reverse.