jurplel / qView

Practical and minimal image viewer
https://interversehq.com/qview/
GNU General Public License v3.0
1.96k stars 118 forks source link

Feature: Support for modern image filtering algorithms. #646

Open infradragon opened 10 months ago

infradragon commented 10 months ago

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 BNLEP3ImageNew

Downscaled, no interpolation, as implemented in gimp (1/2 resolution) none

Downscaled, bilinear interpolation, as implemented in gimp (1/2 resolution) bilinear

Downscaled, nohalo interpolation, as implemented in gimp (1/2 resolution) nohalo

Downscaled, lanczos interpolation, as implemented in XnConvert (1/2 resolution) lanczos

Downscaled, mitchell interpolation, as implemented in XnConvert (1/2 resolution) mitchell

Upscaled, no interpolation, as implemented in gimp (4x resolution) none-up

Upscaled, bilinear interpolation, as implemented in gimp (4x resolution) bilinear-up

Upscaled, nohalo interpolation, as implemented in gimp (4x resolution) nohalo-up

Upscaled, lanczos interpolation, as implemented in XnConvert (4x resolution) lanczos-up

Upscaled, mitchell interpolation, as implemented in XnConvert (4x resolution) mitchell-up

infradragon commented 10 months 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.

infradragon commented 10 months ago

another thing to note is that mitchell is also called "triangle" in some programs

jurplel commented 8 months ago

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.