1--TEST--
2Test Imagick, setCompressionQuality
3--SKIPIF--
4<?php
5$imageMagickRequiredVersion=0x675;
6require_once(dirname(__FILE__) . '/skipif.inc');
7?>
8--FILE--
9<?php
10
11$quality = 15;
12
13function setCompressionQuality($quality) {
14
15    $backgroundImagick = new \Imagick();
16    $backgroundImagick->newPseudoImage(640, 480, "magick:logo");
17
18    $imagick = new \Imagick();
19    $imagick->setCompressionQuality($quality);
20    $imagick->newPseudoImage(
21        $backgroundImagick->getImageWidth(),
22        $backgroundImagick->getImageHeight(),
23        'canvas:white'
24    );
25
26    $imagick->compositeImage(
27        $backgroundImagick,
28        \Imagick::COMPOSITE_ATOP,
29        0,
30        0
31    );
32
33    $imagick->setFormat("jpg");
34    $bytes = $imagick->getImageBlob();
35    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
36}
37
38setCompressionQuality($quality) ;
39echo "Ok";
40?>
41--EXPECTF--
42Ok