ExifTool Forum

ExifTool => Archives => Topic started by: Archive on May 12, 2010, 08:54:16 AM

Title: XMP coyright field -> IPTC copyright field
Post by: Archive on May 12, 2010, 08:54:16 AM
[Originally posted by frereroy on 2008-02-25 12:47:04-08]

Hello,

I would like to copy the copyright field from the XMP information into the IPTC copyright field in a .jpg file
Then delete  the XMP block (which I know how to do)

Could someone please supply a command line or script?

I am on Mac Leopard.

Many thanks.
Title: Re: XMP coyright field -> IPTC copyright field
Post by: Archive on May 12, 2010, 08:54:16 AM
[Originally posted by exiftool on 2008-02-25 13:57:42-08]

Try this:

Code:
exiftool "-iptc:copyrightnotice<xmp:rights" -xmp:all=  image.jpg

- Phil
Title: Re: XMP coyright field -> IPTC copyright field
Post by: Archive on May 12, 2010, 08:54:16 AM
[Originally posted by frereroy on 2008-02-25 14:24:20-08]

Hi Phil,  Many thanks - works like a charm.

My next question is how can a make  "droplet" so that I can can process a whole bunch of files at once -
and even add one or two other fields like Keywords or Title.
 
I realize that this is beyond the scope of this forum and will start looking at scripting/automation on the Mac but I am extremely grateful for the command line which I have already put into action...
Title: Re: XMP coyright field -> IPTC copyright field
Post by: Archive on May 12, 2010, 08:54:16 AM
[Originally posted by exiftool on 2008-02-25 16:03:54-08]

Hi,

It isn't trivial to make a droplet on Mac OS X because you
have to know a bit of AppleScripting.  But you should
be able to get most of what you want if you start from one
of the example Droplets that can be downloaded from the
exiftool home page (see the first two links in the Related
Utilities section).  The first droplet includes exiftool (a
slightly older version now), while the second relies on
exiftool already being installed (probably a better idea
for you).

- Phil
Title: Re: XMP coyright field -> IPTC copyright field
Post by: Archive on May 12, 2010, 08:54:16 AM
[Originally posted by frereroy on 2008-02-25 17:13:41-08]

H,

MANY thanks for all you help so far (+ other helpful messages sent from forum)

I've downloaded and looked at both scripts and AppleScript doesn't look to be my thing!

I think that I prefer the shell stuff. I found the following on a French site that uses ImageMagik's convert to make an intermediary  bmp file  then uses different parts of the XMP and IPTC:

I would like to simplify it and wonder whether the intermediate BMP file is really necessary.

What I am tying to do in fact is to use an image that has been "saved for web" in Photoshop CS3 at 360px wide to insert in articles.
I want it as "slim as possible" the whole XMP block adds 20% to my file size but I want to keep the copyright, a keyword and the the title in IPTC as it takes up very little space.

Here is what I found:
Code:

#!/bin/sh

exiftool="/usr/bin/exiftool"
convert="/usr/bin/convert"

if [ ! -x $exiftool ]; then
  echo "$exiftool not found"
  exit 0
fi

if [ ! -x $convert ]; then
  echo "$convert not found"
  exit 0
fi

if [ "$1" = "" ]; then
  echo "No directory given"
  exit 0
fi

if [ ! -d $1 ]; then
  echo "$1 is not a directory"
  exit 0
fi

dir=$1

for src in $dir/*.jpg; do
   echo "Processing $src..."
   copy=`echo $src.tmp`
   /bin/cp $src $copy
   $convert -resize 600x600 -size 600x600 $src $src.bmp
   $convert -quality 85 $src.bmp $src
   
   $exiftool -q -overwrite_original \
   -TagsFromFile $copy \
   -exif:all \
   -xmp:Description \
   -xmp:Title \
   -xmp:Subject \
   -xmp:Location \
   -xmp:City \
   -xmp:State \
   -xmp:Country \
   -xmp:CountryCode \
   -xmp:Rights \
   -xmp:Creator \
   '-xmp-exif:all > exif:all' \
   '-xmp:Description > exif:ImageDescription' \
   '-xmp:Title > iptc:Headline' \
   '-xmp:Subject > iptc:Keywords' \
   '-xmp:Location > iptc:Sub-location' \
   '-xmp:City > iptc:City' \
   '-xmp:State > iptc:Province-State' \
   '-xmp:Country > iptc:Country-PrimaryLocationName' \
   '-xmp:CountryCode > iptc:Country-PrimaryLocationCode' \
   '-xmp:Rights > iptc:CopyrightNotice' \
   '-xmp:Rights > exif:Copyright' \
   '-xmp:Creator > iptc:By-line' \
   '-xmp:Creator > exif:Artist' \
   '-exif:DateTimeOriginal > exif:CreateDate' \
   '-xmp:Lens > exif:Lens' \
   -xmp:WebStatement \
   -ICC_Profile \
   '-exif:DateTimeOriginal>FileModifyDate' \
   $src
   
   /bin/rm $copy $src.bmp
done
Title: Re: XMP coyright field -> IPTC copyright field
Post by: Archive on May 12, 2010, 08:54:16 AM
[Originally posted by exiftool on 2008-02-25 17:36:34-08]

A few comments:

1) I had thought you wanted a "droplet" to give you the drag-n-drop
ability.  If you don't want this, then shell scripting is definitely the
way to go.

2) The XMP specification states that 2kB of "padding" should
be added.  This is probably the bulk of the difference in size between
XMP and IPTC.  There is an API option to disable the padding, but I
have not provided a command-line option to do this.  So your
best option is currently to convert to IPTC as you are doing.

3) I don't see why you shouldn't be able to do the resize and save
as JPEG without having to go through a BMP.  You could also pipe
the output directly to exiftool to remove all intermediate files
(see the few last posts in
this
thread
for an example.)  You have installed "convert" on
your Mac?  You must be a power user... (ie. Unix background) Smiley

- Phil
Title: Re: XMP coyright field -> IPTC copyright field
Post by: Archive on May 12, 2010, 08:54:16 AM
[Originally posted by frereroy on 2008-02-25 18:09:54-08]

Thanks!

- 1) I had thought you wanted a "droplet" to give you the drag-n-drop ability.

I would have preferred a droplet but got scared off by the apple script Wink

- 3) I don't see why you shouldn't be able to do the resize and save as JPEG without having to go through a BMP. You could also pipe the output directly to exiftool to remove all intermediate files (see the few last posts in this thread for an example.) You have installed "convert" on your Mac? You must be a power user... (ie. Unix background) Smiley

I just copied the script. The resizing is already done for me and I will not need that part. I haven't installed "convert". and wouldn't consider myself a power user although I have "dabbled" with  Linux for a few years and have had a MacBook for 4 months now.

Under Windows I used Exiv2 quite happily but am trying to find a Mac solution. I know that there are ports but I really do not want to get into downloading all the tools, etc.

BTW, the ListExifData AppleScript that is the download section of your site doesn't show me the bottom of the screen when there is lots of data to display. It would need a scroll bar or something

I will carry on experimenting...

Best wishes.
Title: Re: XMP coyright field -> IPTC copyright field
Post by: Archive on May 12, 2010, 08:54:16 AM
[Originally posted by exiftool on 2008-02-25 18:21:46-08]

Well, if you don't need to resize the image and you don't need the
drag-n-drop feature, then you don't really need a script at all since
exiftool will already process an entire directory of images (or an
entire directory tree with the -r option).

But to save typing, you can put all your arguments in a file
(ie. "file.args"), and use a command like this:

Code:
exiftool -@ file.args DIR

You include all of your tag assignments in "file.args", plus you can
add -ext JPG to process only JPG images, -r to
process subdirectories too, and -overwrite_original to avoid
creating the _original files.

- Phil
Title: Re: XMP coyright field -> IPTC copyright field
Post by: Archive on May 12, 2010, 08:54:16 AM
[Originally posted by frereroy on 2008-02-25 21:26:58-08]

Great, I think that I can do what I set out to do now. Thanks for your help and concern!

Please just cast an eye over my file.args to confirm that I haven't put anything in the wrong order or made any fatal mistakes.

Code:
-iptc:copyrightnotice<xmp:rights
-iptc:headline<xmp:title
-iptc:copyrightnotice<xmp:rights
-iptc:keywords<xmp:subject
-iptc:by-line<xmp:creator
-xmp:all=
-iptc:caption-abstract<filename
-exif:DateTimeOriginal>exif:CreateDate
Title: Re: XMP coyright field -> IPTC copyright field
Post by: Archive on May 12, 2010, 08:54:16 AM
[Originally posted by frereroy on 2008-02-26 06:37:12-08]

Hello again, I have been working on getting XMP information from the mother file that hasn't been ressized for web using Photoshop CS3 hence losing all XMP fields except for copyright.

The mother file is  named something like 00abcdef-full.jpg and the reduced size child file is with the -360 suffix
00abcdef-full-360.jpg

Line 4 in the args file below is my attempt to extract data from the mother file which resides in the same directory.

I've been playing with the line but just cannot make it work. Do you have an idea?

Thanks in advance.

Code:

-iptc:copyrightnotice<xmp:rights
-iptc:headline<xmp:title
-iptc:keywords<xmp:subject
-iptc -TagsFromFile '-iptc:by-line<xmp:creator' -w %-.4f.jpg
-xmp:all=
-iptc:caption-abstract<filename
-exif:DateTimeOriginal>exif:CreateDate
Title: Re: XMP coyright field -> IPTC copyright field
Post by: Archive on May 12, 2010, 08:54:16 AM
[Originally posted by exiftool on 2008-02-26 12:54:19-08]

Close.  But the filename must come directly after the
-tagsfromfile, and if you are using a
-@ argfile, you need one argument per line:

Code:
-tagsfromfile
%-.4f.jpg
-iptc:copyrightnotice<xmp:rights
-iptc:headline<xmp:title
-iptc:keywords<xmp:subject
-iptc:by-line<xmp:creator
-xmp:all=
-iptc:caption-abstract<filename
-exif:DateTimeOriginal>exif:CreateDate

- Phil
Title: Re: XMP coyright field -> IPTC copyright field
Post by: Archive on May 12, 2010, 08:54:16 AM
[Originally posted by exiftool on 2008-02-26 13:18:19-08]

BTW, I have also added two more droplets to the List Exif Metadata
example on my web site.  The original droplet written by Rob Lewis
uses a dialog to display the information, but this couldn't be scrolled
as you pointed out.  The new examples use a scrollable text list, and
a TextEdit window to display the information.

- Phil
Title: Re: XMP coyright field -> IPTC copyright field
Post by: Archive on May 12, 2010, 08:54:16 AM
[Originally posted by frereroy on 2008-02-26 13:49:31-08]

Thanks. The filename is correctly parsed but cannot be opened...

Code:
RoyMac:~ roy$ exiftool -@ /Users/roy/Desktop/fileargs /Users/roy/Desktop/Examples/0712wk2944gv-FULL-360.jpg
Error: Error opening file - 0712wk2944gv-FULL.jpg
    0 image files updated
    1 files weren't updated due to errors
RoyMac:~ roy$
Title: Re: XMP coyright field -> IPTC copyright field
Post by: Archive on May 12, 2010, 08:54:16 AM
[Originally posted by frereroy on 2008-02-26 13:56:08-08]

The last 2 work MUCH better. I especially like "List Exif Metadata #1570DC2" with the data sorted by catagories.

BTW, on my screen it takes up the whole width and doesn't seem to be able to be redimensioned which makes it a bit hard to see other things at the same time.

It is a great improvement though. Many thanks.
Title: Re: XMP coyright field -> IPTC copyright field
Post by: Archive on May 12, 2010, 08:54:16 AM
[Originally posted by frereroy on 2008-02-26 14:34:50-08]

Now I get it !!!

Code:
RoyMac:~ roy$ exiftool -tagsfromfile /Users/roy/Desktop/%-.4f.jpg  -@ /Users/roy/Desktop/fileargs  /Users/roy/Desktop/0712wk2944gv-FULL-360.jpg

    1 image files updated
<p>

fileargs
<code>

-iptc:copyrightnotice<xmp:rights
-iptc:headline<xmp:title
-iptc:keywords<xmp:subject
-iptc:by-line<xmp:creator
-xmp:all=
-iptc:caption-abstract<filename
-exif:DateTimeOriginal>exif:CreateDate

and it works.

Great many thanks.
Title: Re: XMP coyright field -> IPTC copyright field
Post by: Archive on May 12, 2010, 08:54:16 AM
[Originally posted by exiftool on 2008-02-26 14:39:07-08]

The problem is that the image isn't in the current directory, so
you need to use %d in the -tagsFromFile argument
for the directory name.  Sorry, I should have thought of this
before:

Code:
-tagsfromfile
%d%-.4f.jpg
-iptc:copyrightnotice<xmp:rights
-iptc:headline<xmp:title
-iptc:keywords<xmp:subject
-iptc:by-line<xmp:creator
-xmp:all=
-iptc:caption-abstract<filename
-exif:DateTimeOriginal>exif:CreateDate

(also interesting that the droplet names got mangled by Stuffit --
apparently there is a maximum name length.  I have shortened the
names and re-uploaded the .sit file for these droplets)

- Phil
Title: Re: XMP coyright field -> IPTC copyright field
Post by: Archive on May 12, 2010, 08:54:16 AM
[Originally posted by frereroy on 2008-02-26 15:07:59-08]

 
Code:
%d  is great - you already thing of an enormous amount of things - can't think of everything !

I have downloaded the droplets again.

Code:
List Exif Metadata (dialog)
has limited usefulness as it displays the old behaviour of not showing the bottom of a long dialogue.

Best wishes, Roy