1--TEST--
2Test Imagick, setSamplingFactors
3--SKIPIF--
4<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
5--FILE--
6<?php
7
8
9function setSamplingFactors() {
10
11    $imagePath = "../imagick/images/FineDetail.png";
12    $imagick = new \Imagick();
13    $imagick->newPseudoImage(640, 480, "magick:logo");
14    $imagick->setImageFormat('jpg');
15    $imagick->setSamplingFactors(array('2x2', '1x1', '1x1'));
16
17    $compressed = $imagick->getImageBlob();
18
19
20    $reopen = new \Imagick();
21    $reopen->readImageBlob($compressed);
22
23    $reopen->resizeImage(
24        $reopen->getImageWidth() * 4,
25        $reopen->getImageHeight() * 4,
26        \Imagick::FILTER_POINT,
27        1
28    );
29
30    $bytes = $reopen->getImageBlob();
31    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
32}
33
34setSamplingFactors() ;
35echo "Ok";
36?>
37--EXPECTF--
38Ok