こんなCPANモジュールがあるので、簡単にできます。
http://search.cpan.org/~exiftool/Image-ExifTool-8.10/lib/Image/ExifTool.pod
とりあえず、インストールして、
yum install perl-Image-ExifTool
こんなコードで、
--------【Perl】--------
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
use Image::ExifTool;
my $file = "input.jpg";
my $tool = new Image::ExifTool;
my $exif = $tool->ImageInfo($file);
print Dumper $exif;
--------
結果は、こんな感じです。
$VAR1 = {
'ImageWidth' => 160,
'Model' => 'DSC-HX5V',
'FlashpixVersion' => '0100',
'ExifImageHeight' => 120,
'ResolutionUnit' => 'inches',
'ColorComponents' => 3,
'InteropVersion' => '0100',
'BitsPerSample' => 8,
'MIMEType' => 'image/jpeg',
'FileType' => 'JPEG',
'ExifToolVersion' => '8.00',
'Directory' => 'bfp_100224/MP_ROOT/102ANV01',
'ImageHeight' => 120,
'FileName' => 'MAH00009.THM',
'XResolution' => '72',
'DateTimeOriginal' => '2010:02:24 15:30:15',
'Make' => 'SONY',
'InteropIndex' => 'THM - DCF thumbnail file',
'CreateDate' => '2010:02:24 15:30:15',
'ExifByteOrder' => 'Little-endian (Intel, II)',
'YCbCrSubSampling' => 'YCbCr4:2:2 (2 1)',
'FileModifyDate' => '2010:02:24 15:30:14+09:00',
'ExifImageWidth' => 160,
'ColorSpace' => 'sRGB',
'EncodingProcess' => 'Baseline DCT, Huffman coding',
'FileSize' => '11 kB',
'YResolution' => '72',
'ComponentsConfiguration' => 'Y, Cb, Cr, -',
'ModifyDate' => '2010:02:24 15:30:15',
'Orientation' => 'Horizontal (normal)',
'YCbCrPositioning' => 'Co-sited',
'ImageSize' => '160x120',
'ExifVersion' => '0221'
};
Perlは何でもできるなー。
--------
http://www.suz-lab.com

0 コメント:
コメントを投稿