<?php
bool public Imagick::writeImages(
string $filename,
bool $adjoin
);
?>
<?php
$image1 = new Imagick();
$str1img = 'img/results/1nri.jpg';
$newarq = 'img/results/4new.png';
$image1->newimage(100, 100, 'black');
$image1->setimageFormat('png');
$image1->writeImages(basename($str1img), false);
$img = imagecreatefromstring($image1);
imagejpeg($img, $newarq);
echo basename($newarq); ?>
<br><br>
<img src="<?php echo $newarq; ?>"
alt="<?php echo $newarq; ?>"
title="<?php echo $newarq; ?>">
array(5) { ["comment"]=> string(60) "CREATOR: gd-jpeg v1.0 (using IJG JPEG v80), default quality " ["date:create"]=> string(25) "2023-01-02T16:31:06+00:00" ["date:modify"]=> string(25) "2022-12-27T18:30:40+00:00" ["jpeg:colorspace"]=> string(1) "2" ["jpeg:sampling-factor"]=> string(11) "2x2,1x1,1x1" }
array(1) { [0]=> object(ImagickPixel)#6 (0) { } }
<?php
$mytifspath = PATH2IMGL . '/tif/';
$my = PATH2IMGL . '/results/5multi.gif';
// Windows paths -
// you are free to choose your own paths
// Use in this exercise only two images
// with the same dimensions and formats
// Format was used: tif
// Again, you are free to choose the format
$multiGIF = new Imagick();
$files = scandir($mytifspath);
foreach( $files as $f )
{
if(($f != '.') & ($f != '..'))
{
$auxIMG = new Imagick();
$auxIMG->readImage($mytifspath.$f);
$multiGIF->addImage($auxIMG);
$multiGIF->writeImages($my, true);
}
}
?>
<?php
$path = PATH2IMGL . '/xtra/';
$my = PATH2IMGL . '/results/5multi1.gif';
// Windows paths -
// you are free to choose your own paths
// Try this exercise placed in the directory: xtra,
// images with different formats and sizes
$multiIMG = new Imagick();
$files = scandir($path);
foreach( $files as $f )
{
if(($f != '.') & ($f != '..'))
{
$auxIMG = new Imagick();
$auxIMG->readImage($path.$f);
$multiIMG->addImage($auxIMG);
$multiIMG->writeImages($my, true);
}
}
?>