The Imagick::identifyFormat() function is an inbuilt function in PHP which is used to replace the embedded format characters with its appropriate image property and returns the interpreted text.
List of escape sequence: Please refer the link to see the list of escape sequence. Ref: http://www.imagemagick.org/script/escape.php
Following are the some of the important embedded formatting characters such as escape sequences for appropriate image property:
Syntax:
string Imagick::identifyFormat( $embedText )
Parameters: This function accepts single parameter $embedText which holds a string containing formatting sequences.
Return Value: This function returns the image format or FALSE on failure.
Below program illustrates the Imagick::identifyFormat() function in PHP:
Program: This program uses Imagick::identifyFormat() function to find the format of given Images.
<?php // Declare new Imagick object $imagick = new \Imagick( // Store a string into variable $embedText = "Output of 'Trim box: %@ number of unique colors: %k' is: <br/>" ; // Use Imagick::identifyFormat() function to replace the embedded // format characters with its appropriate image property $embedText .= $imagick ->identifyFormat( "Trim box: %@ number of unique colors: %k" ); // Display the output echo $embedText ; ?> |
Output:
Output of 'Trim box: %@ number of unique colors: %k' is: Trim box: 656x144+5+15 number of unique colors: 2955
Reference: https://www.php.net/manual/en/imagick.identifyformat.php