PHP | Imagick readImageFile() Function Last Updated : 04 Dec, 2019 Comments Improve Suggest changes Like Article Like Report The Imagick::readImageFile() function is an inbuilt function in PHP which is used to read image from open filehandle. Syntax: bool Imagick::readImageFile( resource $filename, string $fileName = NULL ) Parameters:This function accepts two parameters as mentioned above and described below: $filehandle: It specifies the file handle. $fileName: It specifies the name of file. Return Value: This function returns TRUE on success. Exceptions: This function throws ImagickException on error. Below programs illustrate the Imagick::readImageFile() function in PHP: Program 1: php <?php // Create a new imagick object $imagick = new Imagick(); // Create a file handle $handle = fopen( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png', 'rgb'); // Read the image $imagick->readImageFile($handle); // Display the image header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> Output: Program 2: php <?php // Create a new imagick object $imagick = new Imagick(); // Create a file handle $handle = fopen( 'https://media.geeksforgeeks.org/wp-content/uploads/20191117194549/g4ganimatedcolor.gif', 'rgb'); // Read the image $imagick->readImageFile($handle); // Display the image header("Content-Type: image/gif"); echo $imagick->getImagesBlob(); ?> Output: Reference: https://www.php.net/manual/en/imagick.readimagefile.php Comment More infoAdvertise with us Next Article PHP | Imagick readImageFile() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | Imagick readImage() Function The Imagick::readImage() function is an inbuilt function in PHP which is used to read an image from filename. Syntax: bool Imagick::readImage( string $filename ) Parameters:This function accepts a single parameter $filename which holds the name of the file. It can also accept URL of the file. Return 1 min read PHP | Imagick writeImageFile() Function The Imagick::writeImageFile() function is an inbuilt function in PHP which is used to write the image sequence to an open filehandle. The handle must be opened with fopen. Syntax: bool Imagick::writeImageFile( resource $filehandle, string $format ) Parameters: This function accepts two parameters as 2 min read PHP | Imagick readImages() Function The Imagick::readImages() function is an inbuilt function in PHP which is used to read images from an array of filenames and associate them to a single Imagick object. Syntax: bool Imagick::readImages( array $filenames ) Parameters:This function accepts a single parameter $filenames which holds an a 2 min read PHP | Imagick readImageBlob() Function The Imagick::readImageBlob() function is an inbuilt function in PHP which is used to read an image from a binary string. Syntax: bool Imagick::readImageBlob( $image, $filename ) Parameters: This function accepts two parameters as mentioned above and described below: $image: This parameter is used to 1 min read PHP | Imagick writeImagesFile() Function The Imagick::writeImagesFile() function is an inbuilt function in PHP which is used to writes all image frames into an open filehandle. This method can be used to write animated gifs or other multi-frame images into open filehandle. Syntax:bool Imagick::writeImagesFile( resource $filehandle, string 2 min read Like