Automating Photoshop’s Crop & Straighten Tool

MD
Posted By
Micah_Diamond
Feb 7, 2009
Views
4169
Replies
14
Status
Closed
Does anyone know of a way in which I can automate Photoshop’s "Crop & Straighten" tool?

I don’t think this is as simple as simply creating an Action or a Droplet to perform this task, because running the "Crop & Straighten" tool on an image results in the creation of multiple new images, all of which need to be saved out at some point (either before running the tool again on a subsequent image; or before ending up with hundreds of new/unsaved images open at one time within Photoshop)…

Any suggestions would be greatly appreciated… Thanks!

How to Improve Photoshop Performance

Learn how to optimize Photoshop for maximum speed, troubleshoot common issues, and keep your projects organized so that you can work faster than ever before!

R
Ram
Feb 7, 2009
Use the straighten tool in ACR. ACR can open TIFFs and even lowly JPEGs, not just raw files. One single step straightens and crops.

Adobe Bridge Macintosh forum [CLICK HERE] <http://www.adobeforums.com/cgi-bin/webx?14@@.3bba3d51>

Adobe Camera Raw Forum [CLICK HERE] <http://www.adobeforums.com/cgi-bin/webx?13@@.3bb6a869>

Next time please provide details: CLICK HERE <http://www.adobeforums.com/webx?50@@.2cd06cd9> for advice on how to ask your question correctly for quicker answers. Thanks!
MD
Micah_Diamond
Feb 7, 2009
I don’t think you’ve understood what I was asking about exactly, and I am sorry I didn’t provide enough details to explain this issue for you, but I was under the impression that anyone who has used Photoshop for any decent amount of time would have been able to easily figure out precisely what it is that I am struggling with here…The amount of RAM I’m using, my video card specs, and even the OS using really make no difference at all in this situation…

When I say Photoshop’s "Crop & Straighten" tool, I am referring to the "Crop & Straighten Photos" tool which is available on both the PC and Mac versions of Photoshop from the "File >> Automate >> Crop & Straighten Photos" menu, and to the best of my understanding, this tool is not available from within ACR…or am I mistaken? If so please do tell, but I don’t think I am…

Anyone else have any idea if it’s possible to batch apply Photoshop’s "Crop & Straighten Photos" command to multiple images (each of which contains several smaller images that I would like ‘extracted’ from the larger ‘container’ image…
R
Ram
Feb 7, 2009
I am sorry I didn’t provide enough details

Fair enough.

but I was under the impression that anyone who has used Photoshop for any decent amount of time would have been able to easily figure out precisely what it is that I am struggling with here

Now you’re being a wise ass.
MD
Micah_Diamond
Feb 7, 2009
Alright Ramón. My bad…you win. Now go away, you’re not helping.

Anyone (other than Ramón) have anything helpful they’d like to add?
PR
Paul_R
Feb 7, 2009
MD
Micah_Diamond
Feb 7, 2009
Paul…YOU ARE THE MAN!!! That’s pretty much the sweetest script EVER!!

Not that I am trying to complicate things, but out of curiosity, I don’t suppose there is any way to set up a script to do exactly what the ScanToFile.jsx script does, but perhaps also add approximately 100px to the bottom edge of the extracted images?

Have a look at the following image:
< http://dl.getdropbox.com/u/54787/Screenshots/Far-Side-Comics .png>

It’s indicative of a large group of images I am trying to extract, and the caption that appears on the bottom edge of the image is consistently getting chopped off by the automatic Crop & Straighten feature…

I know that this task is likely impossible, but I figured it couldn’t hurt to ask…Thanks again for referring me to the ScanToFile.jsx script!
PR
Paul_R
Feb 7, 2009
You could add a 100 pixels to each but it would be after the crop and straighten had taken place so you would still loose that data.

I did like the pic though, and wondered if the pages are all of the same type/size maybe you could use a piece of black card with holes cut out to make a mask and use that when scanning, that should define the edges?
MD
Micah_Diamond
Feb 9, 2009
There are about 750 hi-res scanned pages with those comics, and all of the individual comics that appear on each page are arranged in 1 of 4 different grid layouts…

Below is a link to download 4 samples representing each of the 4 arrangements – if you can help me figure out how to create actions designed to crop out each comic (leaving room for the caption, I’d be happy to share the output!

Here are the 4 layouts:
<http://dl.getdropbox.com/u/54787/stuff/far-side-samples.zip>

You’d be truly amazing if you could figure out a way to make each of the individual cropped comics optimized for viewing on an iPhone 🙂

Also…random question…Is there any way to PM on this forum?

Thanks!
R
Ram
Feb 9, 2009
Is there any way to PM on this forum?

No. Email communications are strongly discouraged.

Email responses would defeat the purpose of the forum, which is for everybody to benefit from all questions and answers, not just the original poster.
R
Ram
Feb 9, 2009
You can, however, display your email in your preferences, so any one can just click on your name on any on your post and find directions om how to reach you. Click on my name to see how I break down my email address to keep the spambots from harvesting it automatically.

The majority of forum users do not even make that available.
R
Ram
Feb 9, 2009
majority of forum users do not make even that rout available

Hehehe… Typo for route, or Freudian slip? 😉
PR
Paul_R
Feb 9, 2009
Unfortunately I have tried putting a mask around and that does not work either. It might need another approach.
As manual intervention will be required, maybe a process of open document, use marquee tool to select area and Ctrl/J to create individual layers.
Then once the layers have been created run a script to save those layers and close the document? If you think that might work I will put a script together.
PR
Paul_R
Feb 9, 2009
Ok, If you want to try the above method here is the script. Run it when you have the layers created.

#target photoshop

if(documents.length){

var docPath = activeDocument.path;

var docName = activeDocument.name.slice(0,-4);

var Directory = decodeURI(docPath+’/Edited’);

if(activeDocument.artLayers.length >1) CreateDirectory(Directory);

for(var a=0;a<activeDocument.artLayers.length;a++){

activeDocument.activeLayer = activeDocument.artLayers[a];

if(!activeDocument.activeLayer.isBackgroundLayer){

dupLayer("#"+(a+1));

activeDocument.trim(TrimType.TRANSPARENT);

//comment/uncomment SaveJPEG or SaveTIFF

//SaveJPEG(File(Directory+"/"+docName+activeDocument.name+ ".jpg"), 10);

SaveTIFF(File(Directory+"/"+docName+activeDocument.name+".tif "));

activeDocument.close(SaveOptions.DONOTSAVECHANGES);

activeDocument = documents[0];

}

}

activeDocument.close(SaveOptions.DONOTSAVECHANGES);

}

function dupLayer(newName) {

var desc111 = new ActionDescriptor();

var ref52 = new ActionReference();

ref52.putClass( charIDToTypeID(‘Dcmn’) );

desc111.putReference( charIDToTypeID(‘null’), ref52 );

desc111.putString( charIDToTypeID(‘Nm ‘), newName );

var ref53 = new ActionReference();

ref53.putEnumerated( charIDToTypeID(‘Lyr ‘), charIDToTypeID(‘Ordn’), charIDToTypeID(‘Trgt’) );

desc111.putReference( charIDToTypeID(‘Usng’), ref53 );

executeAction( charIDToTypeID(‘Mk ‘), desc111, DialogModes.NO );

};

function SaveJPEG(saveFile, jpegQuality){

jpgSaveOptions = new JPEGSaveOptions();

jpgSaveOptions.embedColorProfile = true;

jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;

jpgSaveOptions.matte = MatteType.NONE;

jpgSaveOptions.quality = jpegQuality; //1-12

activeDocument.saveAs(saveFile, jpgSaveOptions, true,Extension.LOWERCASE);

}

function SaveTIFF(saveFile){

tiffSaveOptions = new TiffSaveOptions();

tiffSaveOptions.embedColorProfile = true;

tiffSaveOptions.alphaChannels = true;

tiffSaveOptions.imageCompression = TIFFEncoding.TIFFLZW;

activeDocument.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE);

}

function CreateDirectory(Directory){

var PathFold = new Folder(Directory);

if (PathFold.exists == false) PathFold.create();

};
MD
Micah_Diamond
Feb 10, 2009
Paul, I tried your script and it worked beautifully…

Unfortunately, I do not see it as a realistic possibility that I will be spending the time to go through all 750 pages of these comics using the marquee tool on each of them to create new layers out of the individual comics, then using the script…

I thank you so much for your help with this, but as far as figuring out a way to automate the process of creating individual comics out of the batch scanned pages…I think I’ve hit a dead end here 🙁

Thanks again though!

Must-have mockup pack for every graphic designer 🔥🔥🔥

Easy-to-use drag-n-drop Photoshop scene creator with more than 2800 items.

Related Discussion Topics

Nice and short text about related topics in discussion sections