Scaling algorithms in Krita

While preparing another blog-post, I used KDE’s premiere image editing application krita to scale down some large images to a more blog-appropriate size. Krita provides provides several different scaling algorithms to choose from:

  • BSpline
  • Bell
  • Bicubic
  • Box
  • Hermite
  • Lanczos3
  • Mitchell
  • Triangle aka (bi)linear

I used the default “Mitchell” filter to scale a 3008×2000 pixels photo down to 400×266, but the results were slightly unsatisfying — the scaled down version was rather unsharp compared to the original.

Luckily, the fine manual explains some of the algorithms’ properties to the amateur that is me. “Hermite”, “Lanczos3″ and “Triangle” are supposed to produce sharp(er) results. (#135902 already asks for an improved algorithm selection, so don’t worry)

So I did a little experiment to find out which of those algorithms provides the best results to me. Here’s the results of scaling down this image (made by Andriy Rysin btw):

Krita Lanzcos3:
Krita Bicubic:
Krita Hermite:
Krita Triangle:

Lanczos3′s results are very blurry, so not usable at all. Bicubic is better, but not much. Triangular and Hermite produce even better and almost equal results, Hermite’s looks a tad better to me.

The other image manipulation program only offers three different scaling algorithms of which I tried the better ones “Linear” and “Cubic”:

Gimp Linear:
Gimp Cubic:

My conclusion is, that I have to continue to use the gimp for a little while, at least for scaling. I can hardly see a difference between the results of Linear and Cubic, but both of them are quite a bit better than any of the results of Krita.

Now I’m wondering for how long that’s going to last :-)

7 Responses to “Scaling algorithms in Krita”

  1. In my experience, Gimp’s Qubic makes the images more fuzzy than Linear. What I also often do in Gimp – Filters > Enhance > Sharpen (and choose between 10-20) BEFORE I resize.

    Krita is promissed to have edge detection somewhere. Doing that and sharpening the area before scaling down would do wonders.

  2. My question is; lanczcos3 is obviously horrible, so why is it even a choice?

    This is surprising in general, as I was always under the impression that image scaling algorithms were fairly well defined and standard.

  3. As far as I know, cubic scaling is the best choice for scaling up and linear scaling is the best choice for scaling down. In fact, cubic scaling is superior in any case, but when scaling down, you won’t see the difference.

  4. > lanczcos3 is obviously horrible, so why is it even a choice?

    Lanczos should be better than bicubic or bilinear. That it looks horrible is a Krita-only-bug.

  5. That looks like the parameters of the filter were not set correctly. I got pretty good results with Mitchel and Kaiser filters and you can tweak them to get smooth or sharp results.

    One of the most important things when filtering images (even more important than the filter choice) is to do it in linear space, so if your image is gamma corrected, you should transform it to linear space, scale and then transform back to gamma space.

    See these links for more info:

    Mipmapping, part 1.
    http://number-none.com/product/Mipmapping,%20Part%201/index.html

    Mipmapping, part 2.
    http://number-none.com/product/Mipmapping,%20Part%202/index.html

    Paul Heckbert’s zoom library.
    http://www.xmission.com/~legalize/zoom.html

    Reconstruction Filters in Computer Graphics
    http://www.mentallandscape.com/Papers_siggraph88.pdf

  6. Lanczos should do best results with scaling up, while scaling down is not its strongest feautes

  7. Thanks for all those comments, I’m sure they will be helpful to improve scaling for the next Krita version.

Leave a Reply