Analyzing image properties - Imagick : Create and modify images : Graphics Image PHP Source Code


PHP Source Code » Graphics Image » Create and modify images »

 

Analyzing image properties - Imagick


Imagick provides various ways to identify image properties. These properties include for example some basic attributes like width, height, format and some more advanced attributes like exif tags, profiles and colorspaces. Test image test_imagine.jpg

The output looks something like this:

Basic image properties:
Image geometry: 1024x768
Image format: JPEG (Joint Photographic Experts Group JFIF format)
Image type: TrueColor
Image compression: JPEG
Image size: 129.955kb


All image properties:

exif:ApertureValue => 41/10
exif:BrightnessValue => -27/10
exif:ColorSpace => 1
exif:ComponentsConfiguration => ...
exif:CompressedBitsPerPixel => 14/10
exif:Compression => 6
exif:Copyright => J P Bowen
exif:DateTime => 2001:04:12 20:33:14
exif:DateTimeDigitized => 2001:04:12 20:33:14
exif:DateTimeOriginal => 2001:04:12 20:33:14
exif:ExifImageLength => 768
exif:ExifImageWidth => 1024
exif:ExifOffset => 258
exif:ExifVersion => 0210
exif:ExposureBiasValue => 0/10
exif:ExposureProgram => 2
exif:FileSource => .
exif:Flash => 1
exif:FlashPixVersion => 0100
exif:FNumber => 42/10
exif:FocalLength => 58/10
exif:FocalPlaneResolutionUnit => 3
exif:FocalPlaneXResolution => 2151/1
exif:FocalPlaneYResolution => 2151/1
exif:InteroperabilityIndex => R98
exif:InteroperabilityOffset => 708
exif:InteroperabilityVersion => 0100
exif:ISOSpeedRatings => 150
exif:JPEGInterchangeFormat => 856
exif:JPEGInterchangeFormatLength => 10274
exif:Make => FUJIFILM
exif:MaxApertureValue => 41/10
exif:MeteringMode => 5
exif:Model => DX-10
exif:Orientation => 1
exif:ResolutionUnit => 2
exif:SceneType => .
exif:SensingMethod => 2
exif:ShutterSpeedValue => 66/10
exif:Software => Digital Camera DX-10 Ver1.00
exif:XResolution => 72/1
exif:YCbCrPositioning => 2
exif:YResolution => 72/1
jpeg:colorspace => 2
jpeg:sampling-factor => 2x1,1x1,1x1
Signature => 434d8554488bf9af5fc551adeba43e6d1d04ac36559a02357cf5df93db4b35c5

All image profiles:
Profile name: exif (size: 11136)

<?php
$im 
= new Imagick"test_imagine.jpg" );
$identify $im->identifyImage();
/* Ouput some basic attributes */
echo '<b>Basic image properties:</b> <br />';
echo 
'Image geometry: ' $identify['geometry']['width'] , 'x' $identify['geometry']['height'] , '<br />';
echo 
'Image format: ' $identify["format"] , '<br />';
echo 
'Image type: ' $identify["type"] , '<br />';
echo 
'Image compression: ' $identify["compression"] , '<br />';
echo 
'Image size: ' $identify["fileSize"] , '<br />';
echo 
'<br /><br />';
echo 
'<b>All image properties:</b> <br />';
/* Loop trough image properties */
foreach ( $im->getImageProperties() as $k => $v )
{
    echo 
$k ' => ' $v '<br />';
}
echo 
'<br /><br />';
echo 
'<b>All image profiles:</b> <br />';
/* Same goes for properties  */
foreach ( $im->getImageProfiles() as $k => $v )
{
    echo 
"Profile name: "$k " (size: "strlen$v ) ,") <br />";
}
?>




HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Graphics Image
» Create and modify images