OFFLINE-GmbH / oc-responsive-images-plugin

Adds reponsive images capabilities to October CMS
MIT License
45 stars 26 forks source link

Question about image compression #51

Open PubliAlex opened 4 years ago

PubliAlex commented 4 years ago

Hello,

I noticed a small quality decrease when images are resized using this module. I did not see any image quality configuration on the module setting page.

I wonder how to change compression quality, do you have any advices about it ?

Thank you for this wonderful module !

tobias-kuendig commented 4 years ago

We are using October's October\Rain\Database\Attach\Resizer class under the hood, so every image is resized using the default quality options (90%).

You can try to pass in other quality values here and see if this changes something for you: https://github.com/OFFLINE-GmbH/oc-responsive-images-plugin/blob/develop/classes/ResponsiveImage.php#L202

    $this->resizer->resize($size, null, ['quality' => 100])->save($saveTo);

Make sure to clear your storage/temp/public directory first, as a thumbnail is only created once if it not exists already.

PubliAlex commented 4 years ago

Tested and yes, it slightly increase the image quality. Could it be configurable in plugin settings ?

Best regards,

tobias-kuendig commented 4 years ago

Sure, PR welcome!

PubliAlex commented 4 years ago

I will look at this