I want to set custom text to the IPTC field "Special instructions" in Perl.
How can this be done without the usage of a modul?
I want to set custom text to the IPTC field "Special instructions" in Perl.
How can this be done without the usage of a modul?
Updated Again
Ok, in the light of your new requirement to actually read, modify and then re-write the IPTC information, you could use the following to read the IPTC information until we find something better:
which gives this:
Mmm... it appears that that information gets written to
stdout
, and I don't know how to capture it. So I have investigated further and can get the IPTC information like this too:which gives this:
So it looks like individual IPTC fields are separated by:
So, you can read them and create your IPTC.txt file like this:
With my test file I get the following output from this:
Then you can set IPTC data using the Perl API, as follows using the file
IPTC.txt
further down:The following is not a sensible, complete program in itself but it shows how to use the techniques I am suggesting:
Updated
I have made a little progress... I can read the IPTC attributes from an image using the Perl API. For example, the following will read the IPTC Credit:
Original Answer
I am working on this, but the following may be enough to get you started anyway before I finish!
If I create a file like this, and call it
IPTC.txt
and then use ImageMagick
convert
like this:I can insert the IPTC information. I can then test this using
jhead
as follows:I know you don't want to shell out, but this will hopefully get us started on how to do it using the CPAN module you have. Which one do you have, by the way?