0

我正在调整我的 laravel 应用程序中的图像大小,并且正在使用带有 imagick 驱动程序的干预。我只是想问为什么即使图像的大小是300x300px,它的文件大小也是600kb。我原以为它应该是 70-100kb。

这背后的原因可能是什么?

谢谢

4

1 回答 1

0

If you want to adjust a quality it's a very simple to do:

// save file as jpg with medium quality
$img->save('public/bar.jpg', 60);

or without a filename:

// save with medium quality
$img->save(null, 60);

Please take a look on ->save method description: http://image.intervention.io/api/save:

Define optionally the quality of the image. It is normalized for all file types to a range from 0 (poor quality, small file) to 100 (best quality, big file).

The last function used for this example (with GD as an image processing driver) is imagejpeg which has a quality parameter. Or setimagecompressionquality (with Imagick as an image processing driver).

于 2016-02-12T10:57:48.690 回答