Saturday, December 13, 2025
HomeLanguagesPHP | Imagick getImagesBlob() Function

PHP | Imagick getImagesBlob() Function

The Imagick::getImageBlob() function is an inbuilt function in PHP which is used to get the all the image sequences as a blob. This function is useful for animated gifs as doing getImageBlob() on them won’t work. This function implements direct to memory image formats.

Syntax:

string Imagick::getImagesBlob( void )

Parameters: This function does not accept any parameters.

Return Value: This function returns a string containing the images.

Exceptions: This function throws ImagickException on error.

Below programs illustrate the Imagick::getImagesBlob() function in PHP:

Program 1:




<?php
  
// Create a new imagick object
$imagickAnimation = new Imagick(
  
// Show the output
header("Content-Type: image/gif");
  
echo $imagickAnimation->getImagesBlob();
?>


Output:

Program 2:




<?php
  
// Create a new imagick object
$imagickAnimation = new Imagick(
  
foreach ($imagickAnimation as $frame) {
  
    // Apply blur to each frame
    $frame->blurImage(5, 3);
}
  
// Show the output
header("Content-Type: image/gif");
  
echo $imagickAnimation->getImagesBlob();
?>


Output:

Reference: https://www.php.net/manual/en/imagick.getimagesblob.php

RELATED ARTICLES

Most Popular

Dominic
32446 POSTS0 COMMENTS
Milvus
105 POSTS0 COMMENTS
Nango Kala
6814 POSTS0 COMMENTS
Nicole Veronica
11952 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12030 POSTS0 COMMENTS
Shaida Kate Naidoo
6949 POSTS0 COMMENTS
Ted Musemwa
7200 POSTS0 COMMENTS
Thapelo Manthata
6897 POSTS0 COMMENTS
Umr Jansen
6882 POSTS0 COMMENTS