<?php
bool public Imagick::newImage(
int $cols,
int $rows,
mixed $background,
string $format = ?
);
?>
<?php
$image1 = new Imagick();
$str1img = 'img/results/7newI.jpg';
$image1->newimage(200, 200, new ImagickPixel('green'));
$image1->setimageFormat('jpg');
$image1 = $image1->getimageBlob();
$img = imagecreatefromstring($image1);
imagejpeg($img, $str1img);
echo basename($str1img); ?>
<br><br>
<img src="<?php echo $str1img; ?>"
alt="<?php echo $str1img; ?>"
title="<?php echo $str1img; ?>">
<?php
$image2 = new Imagick();
$str2img = 'img/results/7newL.png';
$image2->newimage(200, 200, 'yellow');
$image2->setimageFormat('png');
$image2 = $image2->getimageBlob();
$img = imagecreatefromstring($image2);
imagejpeg($img, $str2img);
echo basename($str2img); ?>
<br><br>
<img src="<?php echo $str2img; ?>"
alt="<?php echo $str2img; ?>"
title="<?php echo $str2img; ?>">
<?php
// Run several times
$image3 = new Imagick();
$str3img = 'img/results/7newK.jpg';
$cols = mt_rand(1, 300);
$rows = mt_rand(1, 300);
$r = mt_rand(0, 100);
$g = mt_rand(0, 100);
$b = mt_rand(0, 100);
$m = mt_rand(0, 99) /100;
$color = new ImagickPixel("rgba($r%, $g%, $b%, $m)");
$image3->newimage($cols, $rows, $color);
$image3->setimageFormat('jpg');
$image3 = $image3->getimageBlob();
$img = imagecreatefromstring($image3);
imagejpeg($img, $str3img);
echo basename($str3img); ?>
<br><br>
<img src="<?php echo $str3img; ?>"
alt="<?php echo $str3img; ?>"
title="<?php echo $str3img; ?>">