View Full Version : Add Tags Automatically for Aspect Ratio
jason531
July 8th, 2008, 06:01 PM
I've searched for an easy way to do this and haven't found anything so far. My wife does a lot of editing using PSE5 and will often crop a photo for a particular print size, such as 4x6, 5x7, or 8x10. I suggested she add a tag or note every time she edits a photo but she hasn't done so.
I told her she can calculate it by looking at the general properties and calculating the quotient of the length and width, then comparing this value to this chart:
Portrait Landscape Tag
0.667 1.500 4x6
0.714 1.400 5x7
0.800 1.250 8x10
0.750 1.333 Std TV
0.563 1.778 WS TV
She is an artist who puts up with technology, but the math is just something she doesn't want to do. It is also a difficult way to find photos of a particular aspect ratio since you have to calculate it one photo at a time.
I would like to somehow calculate the ratio for all of the photos in our collection and add PSE tags based on the chart. Is there an automated way to do this? I am even willing to write a program to do it, perhaps writing this to the EXIF data.
Is there a "simple" way to do this? If I use an app or write a utility to write this to EXIF, what "field" should I use? If it is written to EXIF data, how can I import this as tags back into PSE5? Finally, are there any other ways to import tags?
Thanks in advance for any advice on this!
K:M
July 9th, 2008, 02:21 PM
Interesting idea.
You could certainly write a script of some kind to calculate the ratio, then write it back / append it to the IPTC section as keyword, e.g. "5x7", "4x6", "8x10", etc.
Do you have Photoshop?
You could probably get more mileage by writing a Javascript-based script in PS CSx - the APIs there will be plenty to get the information you're seeking and write it back to the image. Then you can automate.
I know there are people who have been able to export PS CSx actions to PSE5/6. I am not certain about the Javascript code. YMMV.
If you're a Windows/DOS/Shell/Linux hack, however, doing something like this would be very straight-forward on a one-time or scheduled batch. Likely a few lines of code. There is a Perl tool called ExifTool http://www.sno.phy.queensu.ca/~phil/exiftool/ (http://www.sno.phy.queensu.ca/%7Ephil/exiftool/) that works in Windows, and can probably get you what you need.
I suppose if the dimensions of all the cropped images were the same, i.e. 5x7 was 5000x7000, then you could search for all images with a dimension of 5000 and 7000 in the Organizer, then tag them. Depending on how many images you have, doing this manually might not be so bad. If you are dealing with more than, say 100-200, automate it with a little code. But this is probably not the case - chances are you have lots of different sized crops and hence your interest in the ratio.
Good luck,
K:M
jason531
July 9th, 2008, 03:32 PM
Thanks for the advice. I've looked at ExifTool and have written in Perl, even GUI applications using Win32::GUI. It should be a pretty simple program to write. I was hoping to avoid coding if possible, but if I write something that doesn't exist then perhaps others will find it useful.
To meet my personal needs, I will probably write it specifically for Windows, but Perl and ExifTool are cross-platform so it should be easy to port. I'll be willing to share my code if/when I write something. Of course I'm not bent on writing anything right now if anyone else has another suggestion.
johnrellis
July 16th, 2008, 03:25 PM
While you could write a script using “exiftool” to add keyword tags to your photos, you’ll still have a problem. When you first import a photo into the PSE catalog, PSE will give you the option of importing the keywords in the photo’s metadata as PSE keyword tags. But once the photo is in the catalog, PSE will never look at the metadata keywords again. So if you use a tool like “exiftool” to change the metadata keywords of already imported photos, there’s no easy way to get the changes back into PSE.
(If you are really ambitious, you could us Microsoft Access to edit the database file that stores the catalog. But that route is fraught with peril…)
johnrellis
July 16th, 2008, 03:31 PM
K:M’s suggestion of searching for particular sizes sounds more practical. In PSE 5, you’d have to do that manually using the Find command, but in PSE 6 you could make a set of Smart Albums (which are just canned Find queries). For example, you could make a Smart Album to identify all photos whose height is 5000 +/- 500 and whose width is 7000 +/- 500:
Pixel height >= 4500 AND
Pixel height <= 6500 AND
Pixel width >= 6500 AND
Pixel width <= 7500
jason531
July 18th, 2008, 06:25 PM
Thanks for the info, John. It would have been rather frustrating if I had written a piece of software to add EXIF tags only to find out that PSE would not import them.
I've not use PSE6. Do the "Smart Albums" allow you to do queries using calculations, e.g.:
height/width > 1.48 and
height/width < 1.51?
That sounds like the way to go if it does.
johnrellis
July 18th, 2008, 08:31 PM
No, unfortunately you can't do calculations in queries.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.