I am using Imagick in PHP to create an image with the property "chroma subsampling" to 4:2:2 (2x1,1x1,1x1)
I use this code:
$image = new Imagick('test.jpg');
$factors = array("2,1,1");
$image->setSamplingFactors($factors);
$image->writeImage('test2.jpg');
$image->destroy();
but the result is:
jpeg:sampling-factor: 2x2,1x1,1x1
To see the image's properties; I use:
$image = new Imagick(test2.jpg');
$identify = $image->identifyImage(TRUE);
$data = $identify['rawOutput'];
I want to set:
jpeg:sampling-factor: 2x1,1x1,1x1
Thanks in advance for your help and time
I found one solution using 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);
?>
I hope to find the right solution using only imagick methods.