【问题标题】:Imagick setSamplingFactors in phpphp中的imagick setSamplingFactors
【发布时间】:2013-08-26 11:41:09
【问题描述】:

我在 PHP 中使用 Imagick 创建一个图像,其属性“色度二次采样”为 4:2:2 (2x1,1x1,1x1)

我使用这个代码:

$image = new Imagick('test.jpg');

$factors = array("2,1,1");

$image->setSamplingFactors($factors);

$image->writeImage('test2.jpg');

$image->destroy();

但结果是:

jpeg:sampling-factor: 2x2,1x1,1x1

查看图像的属性;我用:

$image = new Imagick(test2.jpg');
$identify = $image->identifyImage(TRUE);
$data = $identify['rawOutput'];

我要设置:

jpeg:sampling-factor: 2x1,1x1,1x1

提前感谢您的帮助和时间

【问题讨论】:

    标签: php php-5.3 imagick php-5.2


    【解决方案1】:

    我找到了一种使用 shell_exec 的解决方案,

    <?php
    
    $path = "e3.jpg";
    $path2 = "e3.jpg";
    $arr = array("-sampling-factor 4:2:2");
    
    $properties = "";
    foreach ($arr as $property) {
        $properties .= $property." ";
    }
    
    $cmd = "convert ".$path." ".$properties." ".$path2;
    
    shell_exec($cmd);
    
    ?>
    

    我希望仅使用 imagick 方法找到正确的解决方案。

    【讨论】:

      猜你喜欢
      • 2014-07-07
      • 2020-04-30
      • 2015-05-09
      • 1970-01-01
      • 1970-01-01
      • 2016-06-20
      • 1970-01-01
      • 2013-12-08
      • 2014-01-26
      相关资源
      最近更新 更多