Open infradragon opened 1 year ago
lanczos is certainly the sharpest but it basically applies a sharpening filter after upscaling which is the reason i dont like it much. you can see sharpening artifacts on the lanczos upscale, especially on the cables and switch on the left. IMO the nohalo algorithm from gimp would be the best to use. however, lanczos implementations vary wildly between programs, as there isnt really a reference implementation.
another thing to note is that mitchell is also called "triangle" in some programs
Yep, agree this would be a nice feature. bilinear is used because it is built into Qt and like you said, it is quite fast. Slower algorithms might require more carefulness with regard to how frequent the image is logically resized, but that may be a fine tradeoff.
While bilinear filtering is fast, it is one of the least quality image filtering algorithms you could use. It matters more than you might expect, especially when trying to read text. I recommend you implement modern lanczos-type filtering algorithms like the lohalo and nohalo algorithms in gimp. It will make reading text in images much much easier and it will also significantly reduce ugly moire patterns (see here). Another useful option would be to use one interpolation method when downscaling, and another when upscaling, such as using nohalo or bilinear to downscale and using no interpolation to upscale, so you can still zoom in and look at the pixels. No interpolation means nearest neighbor interpolation. Demonstration: Original image
Downscaled, no interpolation, as implemented in gimp (1/2 resolution)
Downscaled, bilinear interpolation, as implemented in gimp (1/2 resolution)
Downscaled, nohalo interpolation, as implemented in gimp (1/2 resolution)
Downscaled, lanczos interpolation, as implemented in XnConvert (1/2 resolution)
Downscaled, mitchell interpolation, as implemented in XnConvert (1/2 resolution)
Upscaled, no interpolation, as implemented in gimp (4x resolution)
Upscaled, bilinear interpolation, as implemented in gimp (4x resolution)
Upscaled, nohalo interpolation, as implemented in gimp (4x resolution)
Upscaled, lanczos interpolation, as implemented in XnConvert (4x resolution)
Upscaled, mitchell interpolation, as implemented in XnConvert (4x resolution)