Thursday, April 1, 2010

Automating Photoshop's Crop &...

Does anyone know of a way in which I can automate Photoshop's ''Crop %26amp; 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 %26amp; 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!
Automating Photoshop's Crop %26...
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]










Adobe Camera Raw Forum [CLICK HERE]






Next time please provide details:



CLICK HERE


for advice on how to ask your question correctly for quicker answers. Thanks!
Automating Photoshop's Crop %26...
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 %26amp; Straighten'' tool, I am referring to the ''Crop %26amp; Straighten Photos'' tool which is available on both the PC and Mac versions of Photoshop from the ''File %26gt;%26gt; Automate %26gt;%26gt; Crop %26amp; 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 %26amp; Straighten Photos'' command to multiple images (each of which contains several smaller images that I would like 'extracted' from the larger 'container' image...

%26gt; I am sorry I didn't provide enough details



Fair enough.



%26gt;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 ***.

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?

have a look here...

http://www.adobeforums.com/webx?128@@.59b7368d

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 %26amp; 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!

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?

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!

%26gt;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.



These are, after all, support forums, not social ones.

You can, however, display your email in your preferences, so any one can just click on your name on any of your posts 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.



My feeling is that only flaming, if absolutely necessary, should be done by private communications.



The majority of forum users do not make even that rout available.

%26gt;majority of forum users do not make even that

rout
available



Hehehe Typo for

route
, or Freudian slip? ;)

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.

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 %26gt;1) CreateDirectory(Directory);



for(var a=0;a%26lt;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();



};


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!

No comments:

Post a Comment