Imagick::writeImages


wizard apg

ANIMATES one image or images.



<?php

bool 
public Imagick::writeImages
                               
string $filename
                                 
bool $adjoin 
                                             
);
    
?>    
                                             

$filename


The filename.



$adjoin


This parameter spicifies if the object is write in multipage file.

If true multiple file.

If false sigle file.





This function returns a TRUE on success.



  1 EXERCISE   

<?php

$image1 
= new Imagick();

$str1img 'img/results/1nri.jpg';

$newarq 'img/results/4new.png';

$image1->newimage(100100'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?>">


 RESULT   

UTC BASE TIME, (date:modify):

2024-05-09T16:54:27+00:00


4new.png

img/results/4new.png apr

Properties:
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"
}


Histogram:
array(1) {
  [0]=>
  object(ImagickPixel)#6 (0) {
  }
}

  2 EXERCISE   

<?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($mytrue);
}
}

?>

5multi.gif

img/results/5multi.gif apr

  3 EXERCISE   

<?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($mytrue);
}
}

?>

5multi1.gif

img/results/5multi1.gif apr