Feature requests?

12 views
Skip to first unread message

André

unread,
Oct 22, 2009, 3:26:09 PM10/22/09
to iphotoexport-users
Hi,

After experimenting with iphotoexport, I failed to accomplish the
following:

1-) Exporting photos that are in the library, but not included in any
album. My iPhoto library is quite large and I believe that are
photographs which have not been placed in any album. How could I
export these?

2-) Avoiding duplicates in the export folder. I have a number of smart
albums that partially overlap. When I experimented exporting some of
these, I noticed that for some photographs, iphotoexport creates
aliases of the actual photographs, but for others the photograph is
copied multiple, one for each album in which it appears. My interest
in using iphotoexport is to embed all metadata in the files
themselves, so simply exporting everything as links is not an option
for my intended use.

Considering the above, I believe many users would find it useful to
have the possibility of exporting the entire library with associated
metadata and placing the exported photographs at the root of the
export folder, thus avoiding duplicates (an originals folder could be
created for photos that were edited in iphotos).

Is there a way of accomplishing 1 and 2 using the current version?

Thanks,
Andre

André

unread,
Oct 24, 2009, 11:29:51 AM10/24/09
to iphotoexport-users
Update on post above:

If what one wants is to embed metadata in the EXIF fields of all
photographs in the library by exporting a copy of each photo, but does
not care about re-creating the albums organization in folders, it is
easy to:

1-) Create a regular album in iPhoto, called say EntireLibrary
2-) Drag all photos to this album
3-) Use iphotoexport with options -k -a "EntireLibrary" to export all
photographs to a chosen folder

This solution should avoid duplicates as all photos as copied to the
same destination folder. When I attempted to implement this strategy,
it worked for several photos, but for others I got errors like this:

Error: File format error - /Users/afs25/iPhotoExportFolder/
EntireLibrary/Asthenothaerus maxwelli drawing 001.jpg
Error: Format error in file - /Users/afs25/iPhotoExportFolder/
EntireLibrary/Asthenothaerus maxwelli drawing 001.jpg
Failed to update IPTC data in image /Users/afs25/iPhotoExportFolder/
EntireLibrary/Asthenothaerus maxwelli drawing 001.jpg: 0 image files
updated
1 files weren't updated due to errors

For each of these errors, an alias to the photograph was created in
the export folder. I have no idea what causes this error or how to fix
it. After several of these errors as well as successful exports, the
routine failed with this error:

Traceback (most recent call last):
File "./iphotoexport.py", line 720, in <module>
main()
File "./iphotoexport.py", line 716, in main
export_iphoto(data, export_dir, options.exclude, exclude_folders,
options)
File "./iphotoexport.py", line 604, in export_iphoto
album.generate_files(options)
File "./iphotoexport.py", line 580, in generate_files
self.named_folders[key].generate_files(options)
File "./iphotoexport.py", line 437, in generate_files
self.files[f].generate(options)
File "./iphotoexport.py", line 239, in generate
self.check_iptc_data(self.export_file)
File "./iphotoexport.py", line 264, in check_iptc_data
gps) = exiftool.get_iptc_data(export_file)
File "/Applications/iphotoexport-1.5/tilutil/exiftool.py", line 89,
in get_iptc_data
"%Y:%m:%d %H:%M:%S")
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/_strptime.py", line 330, in strptime
(data_string, format))
ValueError: time data did not match format: data=0000:00:00 00:00:00
fmt=%Y:%m:%d %H:%M:%S

Any ideas of what I am probably doing wrong? Thanks in advance,

Andre

Tilman Sporkert

unread,
Oct 25, 2009, 3:06:30 AM10/25/09
to iphotoexp...@googlegroups.com
Do you have iPhoto configured to not copy photos into your library? If you do that, the original images in your library are just aliases to the real image file. The way iphotoexport copies images, it actually copies the alias, not the file. And then the meta data update fails, because it can't handle an alias. It works for images that you have edited, because then the modified file is actually stored in the iPhoto library. I actually noticed that once before, but didn't follow up because I always check "copy photos into your library".

The fix is easy, if you don't mind modifying the Python script, you can do it yourself. Around line 154 of iphotoexport.py, you find this code:
      # 'cp' is about 4x faster than shutil.copy2() when I tested it a long
      # time ago, but it requires a subprocess
      # shutil.copy2(source, target)
      result = su.execandcombine([ 'cp', '-fp', source, target ])
      if result:
        print >> sys.stderr, "%s: %s" % (su.fsenc(source), result)

Switching it around to use the slower shutil.copy2() will cause it to not copy aliases, but rather the file the alias points to:

      # 'cp' is about 4x faster than shutil.copy2() when I tested it a long
      # time ago, but it requires a subprocess
      shutil.copy2(source, target)
      # result = su.execandcombine([ 'cp', '-fp', source, target ])
      # if result:
      #  print >> sys.stderr, "%s: %s" % (su.fsenc(source), result)

Tilman
--
Tilman Sporkert (til...@sporkert.com)

André

unread,
Oct 25, 2009, 11:35:54 AM10/25/09
to iphotoexport-users
Thank you. That is indeed the case. When I first configured my iphoto
library, I chose not to copy the files. I tried the fix you suggested,
but got an error message informing the "global name 'shutil' is not
defined. Traceback below:

Traceback (most recent call last):
File "./iphotoexport.py", line 720, in <module>
main()
File "./iphotoexport.py", line 716, in main
export_iphoto(data, export_dir, options.exclude, exclude_folders,
options)
File "./iphotoexport.py", line 604, in export_iphoto
album.generate_files(options)
File "./iphotoexport.py", line 580, in generate_files
self.named_folders[key].generate_files(options)
File "./iphotoexport.py", line 437, in generate_files
self.files[f].generate(options)
File "./iphotoexport.py", line 235, in generate
copy_or_link_file(source_file, self.export_file, options)
File "./iphotoexport.py", line 156, in copy_or_link_file
shutil.copy2(source, target)
NameError: global name 'shutil' is not defined

Thank you for your help!
Andre

On Oct 25, 7:06 am, Tilman Sporkert <tspork...@gmail.com> wrote:
> Do you have iPhoto configured to not copy photos into your library? If you
> do that, the original images in your library are just aliases to the real
> image file. The way iphotoexport copies images, it actually copies the
> alias, not the file. And then the meta data update fails, because it can't
> handle an alias. It works for images that you have edited, because then the
> modified file is actually stored in the iPhoto library. I actually noticed
> that once before, but didn't follow up because I always check "copy photos
> into your library".
>
> The fix is easy, if you don't mind modifying the Python script, you can do
> it yourself. Around line 154 of iphotoexport.py, you find this code:
>       # 'cp' is about 4x faster than shutil.copy2() when I tested it a long
>       # time ago, but it requires a subprocess
>       *#* shutil.copy2(source, target)
>       result = su.execandcombine([ 'cp', '-fp', source, target ])
>       if result:
>         print >> sys.stderr, "%s: %s" % (su.fsenc(source), result)
>
> Switching it around to use the slower shutil.copy2() will cause it to not
> copy aliases, but rather the file the alias points to:
>
>       # 'cp' is about 4x faster than shutil.copy2() when I tested it a long
>       # time ago, but it requires a subprocess
>       shutil.copy2(source, target)
>       *#* result = su.execandcombine([ 'cp', '-fp', source, target ])
>       *#* if result:
>       *#*  print >> sys.stderr, "%s: %s" % (su.fsenc(source), result)
>
> Tilman

Tilman Sporkert

unread,
Oct 25, 2009, 11:45:22 AM10/25/09
to iphotoexp...@googlegroups.com
Sorry. I forgot to mention that you also have to add an import statement in line 22 of iphotoexport.py:

import os
import re
import string
import sys
import shutil              <-- add this line
import unicodedata

Tilman
--
Tilman Sporkert (til...@sporkert.com)

André

unread,
Oct 25, 2009, 12:34:59 PM10/25/09
to iphotoexport-users
Thanks. Now the script produces output and in the export folder I find
copies of the photographs rather than aliases. However:

1-) During runtime numerous of these errors are issued:
Error: File format error - <filename>
Error: Format error in file - <filename>
Failed to update IPTC data in image <filename>: 0 image files updated
1 files weren't updated due to errors

2-) Using exiftool -list <filename> to check what was actually written
to the files copied by shutil.copy2 I get:

- for files that are actually contained in the iphoto library it works
nicely (Keywords are copied to EXIF tag Keywords and Comments to EXIF
Caption-Abstract)

- for files that are store elsewhere in the hard disk and only linked
in the library, the EXIF fields of interest appear like this (Tags
written by the camera are erased and neither comments nor keywords are
exported):

ExifTool Version Number : 7.97
File Name : Trigonothracia jinxingae
micrograph 005.jpg
Directory : /Users/afs25/Documents/
Anomalodesmata/iphotoexportfolder2/Taxonomically organized/
Trigonothracia jinxingae
File Size : 0 bytes
File Modification Date/Time : 2007:06:15 09:44:35+01:00
Error : File format error


These are the EXIF tags of the original image, for comparison:

ExifTool Version Number : 7.97
File Name : Trigonothracia jinxingae
[micrograph] 005.JPG
Directory : /Users/afs25/Documents/
Anomalodesmata/Images
File Size : 1396 kB
File Modification Date/Time : 2006:09:13 11:34:22+01:00
File Type : JPEG
MIME Type : image/jpeg
Exif Byte Order : Little-endian (Intel, II)
Image Description :
Make : NIKON
Camera Model Name : E4500
Orientation : Horizontal (normal)
X Resolution : 300
Y Resolution : 300
Resolution Unit : inches
Software : E4500v1.2
Modify Date : 2006:09:13 09:34:23
Y Cb Cr Positioning : Co-sited
Exposure Time : 1/60
F Number : 3.9
Exposure Program : Manual
ISO : 100
Exif Version : 0220
Date/Time Original : 2006:09:13 09:34:23
Create Date : 2006:09:13 09:34:23
Components Configuration : Y, Cb, Cr, -
Compressed Bits Per Pixel : 3
Exposure Compensation : 0
Max Aperture Value : 2.6
Metering Mode : Multi-segment
Light Source : Cool White Fluorescent
Flash : Off, Did not fire
Focal Length : 20.6 mm
Maker Note Version : 2.00
Color Mode : Color
Quality : Fine
White Balance : Fluorescent
Focus Mode : AF-S
Flash Setting :
ISO Selection : Auto
Image Adjustment : Contrast(+)
Auxiliary Lens : Off
Manual Focus Distance : inf
Digital Zoom : 1
AF Area Mode : Single Area
AF Point : Mid-right
AF Points In Focus : (none)
Scene Mode :
Noise Reduction : Off
Data Dump : (Binary data 254 bytes, use -b
option to extract)
Compression : JPEG (old-style)
Preview Image Start : 14409
Preview Image Length : 12943
User Comment :
Flashpix Version : 0100
Color Space : sRGB
Exif Image Width : 2272
Exif Image Height : 1704
Interoperability Index : R98 - DCF basic file (sRGB)
Interoperability Version : 0100
File Source : Digital Camera
Scene Type : Directly photographed
Custom Rendered : Normal
Exposure Mode : Manual
Digital Zoom Ratio : 0
Focal Length In 35mm Format : 99 mm
Scene Capture Type : Standard
Gain Control : None
Contrast : High
Saturation : High
Sharpness : Hard
Subject Distance Range : Unknown
Thumbnail Offset : 4096
Thumbnail Length : 5092
Image Width : 2272
Image Height : 1704
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:2 (2 1)
Aperture : 3.9
Preview Image : (Binary data 12943 bytes, use -b
option to extract)
Shutter Speed : 1/60
Thumbnail Image : (Binary data 5092 bytes, use -b
option to extract)
Image Size : 2272x1704
Light Value : 9.8
Scale Factor To 35 mm Equivalent: 4.8
Circle Of Confusion : 0.006 mm
Field Of View : 20.6 deg
Focal Length : 20.6 mm (35 mm equivalent: 99.0 mm)
Hyperfocal Distance : 17.40 m


Thanks for your help.
Cheers,
Andre

Tilman Sporkert

unread,
Oct 25, 2009, 5:34:14 PM10/25/09
to iphotoexp...@googlegroups.com
That is really odd. I'll experiment a little more with this configuration. Would you mind sharing one of your pictures with me? That might make it easier to debug. Exiftool is actively maintained - maybe there is a newer version available that can handle your particular image. E-mail the image to tspo...@gmail.com. I will use it only for debugging, and then delete it.

Thanks

Tilman
--
Tilman Sporkert (til...@sporkert.com)
Reply all
Reply to author
Forward
0 new messages