douchun1961 2016-07-17 10:29
浏览 20

php复制图像增加文件大小

I am using php to resize and crop images. However the cropped image file is greater than ( much greater in some cases) than the original file. I even tried without cropping (copying the original image) but the resulting size is more than the original image.

$ImageName = '/IMAGES/testImage.jpg';

//Download the Image File

$base_url = 'https://image.jimcdn.com/app/cms/image/transf/none/path/sa6549607c78f5c11/image/ia62ed3191fcc424f/version/1457278719/athens-european-best-destinations.jpg';
$image_size = getimagesize($base_url);
$image_width =  $image_size[0];
$image_height =  $image_size[1];

$src_image = imagecreatefromjpeg($base_url);

//Copy Image Object To File 
imagejpeg($src_image, $ImageName, 100);
  • 写回答

4条回答 默认 最新

  • donglaohua1671 2016-07-17 10:50
    关注

    Technically, the quality rate of the conversion is not derivable from the jpeg data, it just tells the converter which tradeoff to make between size and quality.

    Some converters store it in the EXIF data of the JPEG header though, so if that is still present you can use it with exif_read_data on it, and see if the compression information is returned.

    Source

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog