ArthurHoaro / web-thumbnailer

PHP library which will retrieve a thumbnail for any given URL
MIT License
22 stars 1 forks source link

Change quality #35

Closed RolandTi closed 2 years ago

RolandTi commented 2 years ago

Hello ! I'm trying to get a better quality for the thumbs. I changed the line 111 in ImageUtils.php from imagejpeg($targetImg, $target); to imagejpeg($targetImg, $target,90); but there is still many artifacts. Does I need to add php imageantialias or something like this ? 4747f774d24fd2c6c610fc384b0e3a1c6e2003422501801

Thanks for your help !

RolandTi commented 2 years ago

I think I solved my issue by editing imagecopyresized to imagecopyresampled in ImageUtils.php

nodiscc commented 2 years ago

It would be interesting to see the file size difference between the same thumbnail generated using imagecopyresized and imagecopyresampled. It is true that current thumbnails sometimes look quite aliased/ugly.

image

source: https://www.youtube.com/watch?v=HsZUAq5yvw4

image

source: https://www.wolframalpha.com/

If the size difference is not very important, maybe it could be switched to imagecopyresampled? Or made configurable?

RolandTi commented 2 years ago

23e08f1a446d1fcb2840759503cffab06460788f2501801 23e08f1a446d1fcb2840759503cffab06460788f2501801-1

11ko and 12ko (using 80% quality for jpeg instead of default 75%)

I need to look a little bit more, because I got some "An error occurred. Return code: 500" while displaying to much shaares. Maybe imagecopyresampled ask to much ressources.

ArthurHoaro commented 1 year ago

Thanks for the suggestion, it does look way nicer! I have added this change under a setting that is now enabled by default.