-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Antialiasing not working correctly #183
Comments
Here are the images I used for the screenshot above: https://drive.google.com/drive/folders/1uBYhZc1STvh3qZPcyRWNxExgPBrLkpB2?usp=sharing |
Yes, unfortunately the current implementation of antialiasing only works well for zooming. |
I found this website from the creator of the Magic Kernel which is supposedly what facebook and instagram use to scale their images... It even has a 2021 Reference ANSI C implementation of the Magic Kernel Sharp (MIT-0 License). https://johncostella.com/magic/ https://johncostella.com/magic/magic-kernel-sharp.tar.gz Maybe it is worth having a look, I really have no idea how hard it could be to implement it in swayimg |
Thank you! |
Hello Artem! Sorry for bothering you again. I had the chance to check the antialiasing today and unfortunately I did not notice any improvement, just the jagged edges shifting in place. I've made a comparison between feh's antialiasing and swayimg's and there is a vast difference: As a matter of fact it is impossible to distinguish when antialiasing is enabled in swayimg since it doesn't really change that much. |
FYI, I've started work on antialiasing; I did quite a bit of research into MKS and its ANSI C reference code, plus the Rust implementation referenced from its website. I plan to implement MKS for swayimg (and maybe take another look at the bicubic scaling); this is the reason I've recently started opening issues and pull requests. |
That's great news! |
Hi Artem, I've noticed that the current implementation of the antialiasing doesn't work correctly. I've made a comparison of a thumbnail antialiased by swayimg against imagemagick's cubic filter and there is a massive difference.
I have set my thumbnails to a 300 x 300 pixel size so I ran this command on the images with imagemagick:
magick image_file.jpg -resize 300x300^ -filter cubic -gravity center -extent 300x300 image_file.png
Please check the top row images and compare the left image (swayimg scaling) with the right image (imagemagick scaling). The jagermeister image is inverted, the right image is swayimg's scaling and the left one is imagemagick's scaling.
I think the scaling/antialiasing can be further improved, as it is right now, it is as if nothing is being done to antialias the images. I guess this applies to both viewer and gallery mode although it is more noticeable when viweing the small thumbnails.
The text was updated successfully, but these errors were encountered: