DJ Mike's Tutorials: PHP

Imagick Functions

^

Imagick::identifyimage

Description:
array Imagick::identifyImage ([ bool $appendRawOutput ] )

Identifies an image and returns the attributes. Attributes include the image width, height, size, and others.
Parameters:
appendRawOutput
Errors/Exceptions
Throws ImagickException on error.

Example

<?php 
$image 
= new Imagick('opossum.jpg'); 
$identify $image->identifyImage(TRUE); 

echo 
"<h3>Basic image properties:</h3>"
echo 
"<b>Image Name:</b> $identify[imageName]<br />";
echo 
"<b>Image geometry:</b> " $identify['geometry']['width'] , "x" $identify['geometry']['height'] , "<br />"
echo 
"<b>Image format:</b> "$identify["format"] , "<br />"
echo 
"<b>Units:</b> $identify[units]<br />";
echo 
"<b>Image type:</b> " $identify["type"] , "<br />"
echo 
"<b>Colorspace:</b> $identify[colorSpace]<br />";
echo 
"<b>Image compression:</b> " $identify["compression"] , "<br />"
echo 
"<b>Resolution:</b> x=" $identify['resolution']['x'] . "y=" $identify['resolution']['y']. "<br />" ;
echo 
"<b>Image size:</b> " $identify["fileSize"] , "<br />"

echo 
"<h3>Raw Output:</h3><pre>$identify[rawOutput]</pre>";
?> 


Basic image properties:

Image Name: /home/djmike/public_html/mike/tutorials/php/imagemagick/examples_03/opossum.jpg
Image geometry: 176x135
Image format: JPEG (Joint Photographic Experts Group JFIF format)
Units: PixelsPerInch
Image type: TrueColor
Colorspace: RGB
Image compression: JPEG
Resolution: x=72y=72
Image size: 7.16kb

Raw Output:

Image: /home/djmike/public_html/mike/tutorials/php/imagemagick/examples_03/opossum.jpg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Class: DirectClass
  Geometry: 176x135+0+0
  Resolution: 72x72
  Print size: 2.44444x1.875
  Units: PixelsPerInch
  Type: TrueColor
  Endianess: Undefined
  Colorspace: RGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    red:
      min: 0 (0)
      max: 255 (1)
      mean: 157.515 (0.617706)
      standard deviation: 70.9565 (0.278261)
    green:
      min: 0 (0)
      max: 255 (1)
      mean: 131.479 (0.515603)
      standard deviation: 69.908 (0.274149)
    blue:
      min: 0 (0)
      max: 255 (1)
      mean: 138.21 (0.542001)
      standard deviation: 65.2929 (0.256051)
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: rgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Page geometry: 176x135+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG
  Quality: 80
  Orientation: Undefined
  Properties:
    create-date: 2012-05-18T23:48:55+00:00
    jpeg:colorspace: 2
    jpeg:sampling-factor: 2x1,1x1,1x1
    modify-date: 2012-05-18T23:48:55+00:00
    signature: 1908a9dc0995f74ae9d795fcc06afcd8e5df67b630fd78bb9c51e5bcef9298b4
  Tainted: False
  Filesize: 7.16kb
  Number pixels: 23.2kb
  Version: ImageMagick 6.4.8 2009-09-04 Q16 OpenMP http://www.imagemagick.org


^


Was this webpage useful to you? You can support this website by donating.


Created by DJ Mike from Santa Barbara

DJ Mike


<a href="http://www.statcounter.com/" target="_blank"> <img src="http://c5.statcounter.com/counter.php?sc_project=1321035&java=0&security=da2193dc" alt="counter free hit invisible" border="0" /></a>