Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

XMP, Image::ExifTool, strawberryperl

by mrkjell (Initiate)
on Nov 25, 2009 at 17:48 UTC ( #809375=perlquestion: print w/replies, xml ) Need Help??
mrkjell has asked for the wisdom of the Perl Monks concerning the following question:

Hi. I wonder if anyone might help me with my problem. I want to create a crossplatform application to tag, register, scale and upload my images. I use ExifTool to create an XMP to store some metadata in the imagefiles. This works great in debian, but the metadata written in XP ( strawberryperl ) is not readable. I have hexdumped the images, and there is small changes in the data, but I cant see any notes of this in the changelog of exiftool. A quickfix would be to use system calls and use the exiv2-util, but I really want to native perl. Have anyone ever tried to work with XMP-data in a crossplatform setting with perl? Does there exists other alternatives to ExifTool? Thank you reading this. Any feedback would be great. Best regards.

Replies are listed 'Best First'.
Re: XMP, Image::ExifTool, strawberryperl
by Anonymous Monk on Nov 26, 2009 at 01:28 UTC
      Hi. Thank you for the reply. I have been looking on binmode. It was hard to find any options regarding this. Do you mean Binary? like this:
      $exifTool->Options( Binary => 1 );
      It did not do anything different. I have also looked at encoding. Bestregards.
Re: XMP, Image::ExifTool, strawberryperl
by boardhead (Novice) on Nov 26, 2009 at 17:26 UTC
    ExifTool should work just fine in XP. Why do you say the output is unreabable? What can't read it? I'm sure exiftool can. The only possible difference I could see is with the newline character, but XMP is perfectly valid when written with any newline sequence. - Phil
      Hi. Thank you for your reply. I really appreciate it. Yes, it looks like ExifTool works fine, but the XMP data is not readable when I try to dump this information with exiv2 ( on linux ). I did not make it work with "The PHP Metadata Toolkit".
      It might be that ExifTool is folowing the standards, but the files is not readable for other tools, so this is my problem.
      #I tag a file like this: my $exifTool = new Image::ExifTool; $exifTool->ExtractInfo($image); $exifTool->SetNewValue('XMP:Headline' => "heisannheisann"); $exifTool->WriteInfo($image);
      When I look at this file with the string util in linux, I get this block: <?xpacket begin=' ' id='W5M0MpCehiHzreSzNTczkc9d'?> <x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 7.89'> <rdf:RDF xmlns:rdf=''> <rdf:Description rdf:about='' xmlns:photoshop=''> <photoshop:Headline>heisannheisann</photoshop:Headline> </rdf:Description> </rdf:RDF> </x:xmpmeta> <?xpacket end='w'?> -- but the exiv2 tool says: $ exiv2 -p x Vannliljer.jpg Vannliljer.jpg: No XMP data found in the file When i do the same thing on a linux box, I get this: $ exiv2 -p x tmp.jpg Xmp.photoshop.Headline XmpText 14 heisannhei +sann $ <?xpacket begin=' ' id='W5M0MpCehiHzreSzNTczkc9d'?> <x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 7.30'> <rdf:RDF xmlns:rdf=''> <rdf:Description rdf:about='' xmlns:photoshop=''> <photoshop:Headline>heisannheisann</photoshop:Headline> </rdf:Description> </rdf:RDF> </x:xmpmeta>
      Any more clues? best regards. Kjell
        Thanks for the extra information.

        Just to point out that one obvious difference is that the linux box is running Image::ExifTool version 7.30, whilst windows is running a more recent 7.89. This is a possible factor.

        You could experimentally try backing out your Windows version using Image::ExifTool 7.30 from backpan, just to confirm this, or rule it out.

        Some more debugging discovered some embarrassing things.
        Being so focused on the borked metadata, I did not realize that the image also got resized using Image::Magick. I gues the problem is not Image::ExifTool after all. Ill gues I now suspect Image::Magick :)
        Thank you for all you help so far.
        Best regards.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://809375]
Approved by keszler
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2018-05-23 15:55 GMT
Find Nodes?
    Voting Booth?