PDA

View Full Version : How to batch trim / crop image files


Geoff Tani
05 January 2006, 10:19 PM
Hi all,

I have about 1000 pictures saved as .psd files, and I want some way to trim them automatically.

They are all old family photographs. I put the original photograph on top of a solid black piece of paper, then took a picture of it. So all the photocopies (the pictures I shot) have a black border. But the width of the border is different in each picture file, and sometimes the left border is much wider than the right border, etc.

I want to trim the borders so that they are uniform in size, or get rid of the borders entirely. I can do this manually, but I'd prefer to automate it and save time.

There is a feature in Photoshop CS called Trimming, but it appears to trim only that part of the canvas where there is no image. Since the black border is considered inside the image, it is not trimmed. If I am using the feature incorrectly, please let me know.

I know about the Record Action feature in Photoshop CS to automate things. However, including Trimming, I cannot think of a step that trims the way I want to.

Questions:
1. Is there a way in Photoshop to do this?
2. If not in Photoshop, is there another application that can do this?
3. If there is no application that can do this, any suggestions?

Thank you very much for your help.

dfilpus
05 January 2006, 10:49 PM
In Photoshop Elements 3, there a function called "Divide Scanned Photos", which is intended to be used after you've scanned multiple photos at once. It looks inside the image for imbedded photos. It then rotates the image to right/left alignment and crops to just the photo. It will create a new image for each photo it finds. For one imbedded photo, it does exactly what you want. However, Elements does not automate that function, so it would be one image at a time.

Dennis J. Cunniff
05 January 2006, 11:54 PM
Photoshop has both a "trim" and a "crop" command, and I think the latter does what you want it to (also "straighten and crop" might be useful). If any of these does what you like, it should be possible to automate the task with Automater or AppleScript.

Tom Robinson
07 January 2006, 03:25 AM
Photoshop has both a "trim" and a "crop" command, and I think the latter does what you want it to (also "straighten and crop" might be useful). If any of these does what you like, it should be possible to automate the task with Automater or AppleScript.
The ubiquitous GraphicConverter also has batch processing commands and includes crop and trim commands: File -> Convert & Modify -> Edit Batches (though I can't swear they'll do what you're after).

The mailing list for GC is almost as friendly & helpful as this one ;-}

http://groups.yahoo.com/group/gcmac/

Remember to pay the shareware fee if you find it useful.

Geoff Tani
29 January 2006, 03:45 AM
Photoshop has both a "trim" and a "crop" command, and I think the latter does what you want it to (also "straighten and crop" might be useful). If any of these does what you like, it should be possible to automate the task with Automater or AppleScript.
To further explain the crop feature, Mr. Cunniff sent me the below instructions:

Various versions of Photoshop have different commands, and the one that crops and straightens is in one place in Photoshop Elements 2.0, and another in Photoshop CS version 8.0.

In Photoshop Elements 2.0, under the "Image" menu, and the "Rotate" submenu, is a selection titled "Straighten and Crop Image". It straightens a scanned image and crops it without you having to select the pixels (it works well most of the time, but sometimes doesn't
quite get it right).

In Photoshop CS version 8.0, under the "File" menu, and the "Automate" submenu, the choice is "Crop and Straighten Photos". (It's "greyed out" until you've opened a photo, and it will separately crop and straighten several photos scanned together).
With these instructions, I recorded an action in Photoshop with the steps:
1. Straighten & Crop Image
2. Expand Canvas Size by 5mm all directions (color black)
I am able to select and run this action from the batch dialog.

I've tried the batch on a folder with about 30 images. It appears to clean them up well. Some images are cropped incorrectly. But it still appears to save a lot of time.

Most people know Photoshop better than I do. If you create a better automated action in Photoshop, please post it to this thread.

Thank you, everyone, for your help!