Cookie Into the (open) source


Graphics: interpolation to resize images with Gimp

Inspired by the comments to one of my old article, write a short guide to clarify any questions on 'graphic interpolation. The short article today will speak only interpolation from the point of view of the graphic software, but it must be pointed out that the interpolation is first and foremost a method for detecting 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.

Read more ...

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 between the data points, and create new ones with the same degree of randomness. Many will be puzzled to see me report 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 in order to optimize the image size according to user preference. Without using interpolation from graphical images magnified would dramatically jagged. 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 little 'more exorbitant burden as the CPU, but it certainly offers the best yield.

  • "No": simply copies the original pixels in the surrounding spaces. It 's 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.




Sinc (Lanczos3)

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.


I keep this blog as a hobby by 2009. I am passionate about graphic, technology, software Open Source. Among my articles will be easy to find music, and some personal thoughts, but I prefer the direct line of the blog mainly to technology. For more information contact me.

Comments (2) Trackbacks (0)
  1. Ciao the joe , see here I did not know the meaning of the various interpolation methods , was a major flaw that the filled admirably , log Fabri.
    Also I use linux with great pleasure and are passionate about graphic.

    • Hello fabrizio, it's nice to know they are not alone in the world to do graphics with linux and open source software, and it's even nicer to know I could help someone.

      I took a tour on your blog, I'm not a luminary, but if I could I would give you some advice:
      – your tutorials are original, and not the usual plagiarized and effects that try to recreate are interesting. No images, however, is a little’ difficult to follow the procedure, then tries to integrate your articles with step-by-step pictures, otherwise you can get lost in the third passage.
      – the first article of May, it means you're online for a while '. Seeks to integrate the blog with links, as it is just a list unappetizing and you run the risk that people run away to some other site.

      If you happen to see me again passes, I plan some other tutorials for gimp (is not a lot that I write one). Hello!

Leave a comment

No trackbacks yet.