• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Need a script to batch automate "Crop & Straighten"

New Here ,
Apr 20, 2012 Apr 20, 2012

Copy link to clipboard

Copied

So I have a few hundred image files that consist of 3 or 4 scanned photos also called "gang" scanned. The photoshop "Crop & Straighten" ability (located under File-->Automate) is great...But I want to be abe to run a script that will prompt me for a folder to be processed and then run the Crop & Straighten on all the photos, while saving them to another folder called "Edited" or something.  I found a script in the forums for this exact purpose, but it doesn't seem to work in CS5.  I ran it multiple times, it creates the folder "Edited" but nothing is inside of it. The script I found is posted below. Any ideas? I would really appreciate the help!

#target Photoshop
app.bringToFront;
var inFolder = Folder.selectDialog("Please select folder to process");
if(inFolder != null){
var fileList = inFolder.getFiles(/\.(jpg|tif|psd|)$/i);
var outfolder = new Folder(decodeURI(inFolder) + "/Edited");
if (outfolder.exists == false) outfolder.create();
for(var a = 0 ;a < fileList.length; a++){
if(fileList instanceof File){
var doc= open(fileList
);
doc.flatten();
var docname = fileList
.name.slice(0,-4);
CropStraighten();
doc.close(SaveOptions.DONOTSAVECHANGES);
var count = 1;
while(app....























TOPICS
Actions and scripting

Views

13.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Apr 21, 2012 Apr 21, 2012

The script is only looking for jpg, tif or psd files, if your files are in a differenent format that format would need adding to the script.

It also could be a problem with the editor you used to save the script, some programs will add control characters and stop the script working.

It is best to use ExtendScript Toolkit as this is the program installed with Photoshop for editing/testing scripts.

Votes

Translate

Translate
Adobe
Community Expert ,
Apr 21, 2012 Apr 21, 2012

Copy link to clipboard

Copied

Could you please post an exemplary scan (in lores)?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Apr 21, 2012 Apr 21, 2012

Copy link to clipboard

Copied

The script is only looking for jpg, tif or psd files, if your files are in a differenent format that format would need adding to the script.

It also could be a problem with the editor you used to save the script, some programs will add control characters and stop the script working.

It is best to use ExtendScript Toolkit as this is the program installed with Photoshop for editing/testing scripts.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 21, 2012 Apr 21, 2012

Copy link to clipboard

Copied

I feel like a complete idiot...Turns out that my scanned images were saved as .jpeg instead on .jpg...so  I changed the extensions and it worked like a charm! Thanks guys!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 08, 2015 Apr 08, 2015

Copy link to clipboard

Copied

Hi there,

I have tested one script and encountered one problem; the script/PS is very aggressive. The result has been that single images have been divided to multiple images and many time "over cropped" and rotated in various degrees. Crazy : )

Example Before/after:

Dropbox - PS CROP&STRAIGHTEN

Script used:

Dropbox - CROPAndStraightenBatch.jsx

I have about 3000 images that I would like to have cropped.

What I would like to have is a script where I can state or set it to not allow it to divide pictures into many.

Also...any script that can automate rotations as batch?

Does this exist somewhere?

Are there any scripts somewhere that I can test?

Cheers

Martin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 24, 2015 Sep 24, 2015

Copy link to clipboard

Copied

Capture.JPG

I've tried every snippet of code I can find, for the life of me, I can't get a batch to work, they all hangup on the call to the action

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

you can do this with an action and a batch process.  start recording and action, open a file to be processed, run the auto crop & streighten, them file -> close all, and choose the folder you wish to save to. Then batch process that action with the folder of unprocessed images as the source and save and close as the destination. Doing this from memory so I may have a detail or two wrong.

scaned over a thousand photos this way and included a auto color correction into the action. Worked very well.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 08, 2019 Aug 08, 2019

Copy link to clipboard

Copied

Greetings! I saw Rob's reply above about automating this process using an action and batch process (as opposed to the script being used in the OP). I used to have this set up and lost it when I upgraded to CC years ago.

​As Rob accomplished this as well as myself in the past, I know it can be done. However, Adobe support is lacking on this simple Action topic and most in the forums are using scripts like the OP for this should be simple task.

​I had gotten about as far as Rob's instructions, before finding this thread but have some hang ups. I am hoping he or someone else may run by me the actual steps needed for this Action.

​My requirements would be to crop and straighten all images in source folder. Then have the newly created individual jpg files saved with quality 10 while maintaining sRGB and ICC profile to the destination folder and have PS automatically close the file. I would like to do this without the Save As dialogue box popping up for each and every file.

I have also attempted to use the Action with the Image Processor without success but am open to the easiest method.

​I can elaborate further as needed nut that is the simple gist of it.

​Please help me resume and finish my years long family photo cataloging project!

​Thank you so much for taking the time to help should you choose to. If you do not care to or are not sure about an item or two please do let me know and if possible point me to an appropriate resource to get me to the finish line.

​Regards, Sean

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 01, 2024 Oct 01, 2024

Copy link to clipboard

Copied

LATEST

If you add in a save to your action it will save each file the same and the box won't pop up. A problem I have been running into is that when you use automate crop and straighten it saves the file automatically with the word "copy" afterwards because the automate crop and straighten function creates a copy and doesn't edit the original. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines