Reputation: 1783
I want to convert jpg to webp and set the quality to 50 (as an example). But the Image Intervention only supports the quality parameter only for jpg files.
quality (optional)
Define the quality of the encoded image optionally. Data ranging from 0 (poor quality, small file) to 100 (best quality, big file). Quality is only applied if you're encoding JPG format since PNG compression is lossless and does not affect image quality. Default: 90.
Is there any workaround?
Upvotes: 2
Views: 2445
Reputation: 1
$webp = Image::make('public/foo.png')->encode('webp', 75); this only applies when you converting to .jpg from .png
Upvotes: 0
Reputation: 2196
As specified in docs: https://image.intervention.io/v2/api/encode You can encode the image in given format and given image quality.
$webp = Image::make('public/foo.png')->encode('webp', 75);
I did this today and worked as expected. Try to encode both qualities 80 and 100 and you will note the size difference, also a quality difference if you set it under 80
Upvotes: 1