Converting TIFF to JPEG with sips, then import into iPhoto problems

I am cataloguing a box of slides and negatives for my family. The scanner generates huge TIFF files (on purpose), and I have an Applescript that then uses sips to copy them into low quality JPEG files using this command:

do shell script ("sips -s format jpeg -s formatOptions low -s description " & "'" & "Original path: " & (POSIX path of an_image) & "'" & space & (POSIX path of an_image) & " --out " & new_file)


where an_image is the source file, and new_file is the path and name of the converted image.

This way, I can save the original file path as the image's description while shrinking the file size to speed up later importing into iPhoto. As part of the iPhoto import, that description from the metadata is placed in the on screen comment section for each image.

This works fine to do the initial shrinking, but less than half of the resulting jpeg files can subsequently be imported into iPhoto. I get this error:

The following file could not be imported. (The file is in an unrecognizable format.)


And yet, Preview and Safari both open the files with no problems.

Is there anything else I need to set when doing the conversion with sips to make it easier for iPhoto to recognize the converted files?

I have over 1000 images, and anticipate a final total of about 2500 when I am done. These are images of myself and my siblings from the 1960s and 1970s, and my idea is to scan them all at high resolution, and use the converted, smaller files for iPhoto for keywording and Faces to get them organized, while retaining the paths to the original images. Any commentary is appreciated.

MacBook, Mac OS X (10.5.6)

Posted on May 11, 2009 9:27 AM

Reply
8 replies

May 11, 2009 11:44 AM in response to casdvm

It appears to have something to do with the conversion from TIFF to JPEG. When I simply reduce the size of the TIFF file thusly:

do shell script ("sips --resampleWidth 2000 -s description " & "'" & "Original path: " & (POSIX path of an_image) & "'" & space & (POSIX path of an_image) & " --out " & new_file)


iPhoto can import 100% of the smaller TIFF images without any issues whatsoever.

May 11, 2009 8:28 PM in response to xnav

I have uploaded one of the bad JPG files here:

www.mrcodeboy.com/smith/Try.jpg

I tried examining the metadata with exiftool, Image Events, and mdls, but there are a number of differences between the TIFF metadata and the JPEG metadata structures. I found no obvious differences, but this is a good idea, and I will continue to examine those closely for clues.

*EDIT*

I downloaded the bad JPEG above onto a different machine; it still does not import into iPhoto. However, by invoking sips on that file to convert it back to a TIFF file thusly:

sips -s format tiff Try.jpg --out TryTF.tif


it imported just fine. There has to be some sort of parameter that is NOT being addressed in the conversion from TIFF to JPEG that is somehow messing this up, yet is preserved when the file is re-written as a TIFF.

Message was edited by: casdvm

May 12, 2009 8:11 AM in response to casdvm

I was able to import your file to iPhoto, however this error was written to the console:

[0x0-0x1e01e].com.apple.iPhoto[261] Tue May 12 05:02:28 BudMac.local iPhoto[261] <Error>: CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 16 bits/pixel; 1-component colorspace; kCGImageAlphaPremultipliedFirst; 1920 bytes/row.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Converting TIFF to JPEG with sips, then import into iPhoto problems

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.