Highlighted

Is there a way to add padding to the automated crop and straighten photos?

New Here ,
Aug 25, 2020

Copy link to clipboard

Copied

I have scans of hundreds of photos, with nice white borders on a black background, that need to be cropped and straightened and would like to use the automated crop and straighten photos tool. BUT I need to leave a border around the photo's edge (10-20 pixels). Is there a way to have that action leave space in its auto crop? I don't want to crop the image and then copy it into a new image to create an artificial border, I need to retain the original background. I'm currently using CS6, but can get access to the newest version of Photoshop if needed. I have attached an example of the original (69348.jpg), the auto crop and straighten (69348auto.jpg), and the way I want it to look (69348proper.jpg).

 

Any help would be greatly appreciated as I will have a lot more like this in the future.

Topics

Actions and scripting, How to

Views

113

Likes

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

Is there a way to add padding to the automated crop and straighten photos?

New Here ,
Aug 25, 2020

Copy link to clipboard

Copied

I have scans of hundreds of photos, with nice white borders on a black background, that need to be cropped and straightened and would like to use the automated crop and straighten photos tool. BUT I need to leave a border around the photo's edge (10-20 pixels). Is there a way to have that action leave space in its auto crop? I don't want to crop the image and then copy it into a new image to create an artificial border, I need to retain the original background. I'm currently using CS6, but can get access to the newest version of Photoshop if needed. I have attached an example of the original (69348.jpg), the auto crop and straighten (69348auto.jpg), and the way I want it to look (69348proper.jpg).

 

Any help would be greatly appreciated as I will have a lot more like this in the future.

Topics

Actions and scripting, How to

Views

114

Likes

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
Adobe Community Professional ,
Aug 25, 2020

Copy link to clipboard

Copied

It is leaving the white border - you mean you want the extra black background in the images?? There is no way to do this with the automated crop and straighten. You could create an action to enlarge the canvas after the fact but you can't do what you are looking for in your propper image except by hand that I'm aware of. 

Likes

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
Reply
Loading...
New Here ,
Aug 25, 2020

Copy link to clipboard

Copied

Yeah, the extra black background. I kind of figured that was the case. Hoping maybe someone with scripting knowledge might have developed something.

Likes

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
Reply
Loading...
Adobe Community Professional ,
Aug 25, 2020

Copy link to clipboard

Copied

I'm with Melissa, do the crop as desired, then just make an Action to extend the canvas by X number of pixels or percentages etc. Be sure to set the bkgnd color as desired.

Once you have the action, you can then run a batch on a folder of cropped images. 

Likes

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
Reply
Loading...
Most Valuable Participant ,
Aug 25, 2020

Copy link to clipboard

Copied

You example and your process description do not belong to together.

You first image look like you used a flat bed  scanner with a gray background to scan a print at 300 DPI print resolution. images 69348

You Auto process removed gray background straightened the Image a trimmed the Transparency image 69348auto

Your third image is  the auto image with a resized canvas  to make the image the desired 10" x 8" 300 Print size. 69348propper

The canvas Color can be any you want.

 

The was no cropping done there would be no borders added if the scan print was  10" x 8" paper  size can camg ams net bi be a perfect 10" by 8" in this case the canvas was sized up 101.46% of the scan sizeled the 1.5%. 

 

Action can not use logic to deal with image size.  Actions are recorded Photoshop steps the step are record on a single size document and the steps are record for that size image.  If all you scans are not of 10" x 8"  prints.  You will either need to use Photoshop scripting to deal with Image size, or record an action for each scan print size and batch process one print size size scan at a time. 

69348.jpg69348auto.jpg69348proper.jpg

JJMack

Likes

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
Reply
Loading...
New Here ,
Aug 25, 2020

Copy link to clipboard

Copied

Thanks for the comments, but I wanted to clarify a some things. Yes, I used a flat bed scanner with a gray background to scan a print at 300 DPI. The "auto" image was made by simply running the Crop and Straighten Photos tool under Automate and saved. The "proper" image was just manually straightened and cropped. The canvas was not resized and no border was added. As for the size, most of the scans are of 8x10 photos, but the end product does not need to be any specific size. 

 

Basically I'd like the Crop and Straighten Photos tool to 1) Straighten the image, 2) Find the spot it would normally crop, 3) Push those crop lines back 10-20 pixels in all four directions, and then 4) Crop. I figure scripting may be necessary. 

Likes

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
Reply
Loading...
Most Valuable Participant ,
Aug 25, 2020

Copy link to clipboard

Copied

Again what you write is wrong.  You can not add boarders if there is no canvas to add them onto.  Canvas was added.  All you need do is look at the documents you posted Image size. clearly proper image canvas is larger than auto image.

Capture.jpg

 

Yes that is the name of the tool/feature. What is cropped is not the scanned images its the scanners gray background. The image is not cropped.

JJMack

Likes

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
Reply
Loading...
Most Valuable Participant ,
Aug 25, 2020

Copy link to clipboard

Copied

Look closer at your two images  Auto an Proper using Photoshio ruler tool from top left to top right image cornors the image line is a not a true straight line and the line slope from cornor to cornor is .1 degree,

 

Again with the rulet tool on Proper Image cornor to cornor the line is not a true straight line and the slope is .2 degree.

 

So auto is more level than proper.

Capture.jpg

 

IMO all you need is the one line action you can batch and have the Batch processor save you output imags is some folder.

 

One action step menu File>Automate>Crop and Straighten Photos

JJMack

Likes

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
Reply
Loading...
Adobe Community Professional ,
Aug 25, 2020

Copy link to clipboard

Copied

It still seems like you might not understand that since Crop and Straighen Photos can’t do this by itself, we’re suggesting it is possible if you simply combine multiple Photoshop features.

 

I decided to try Melissa’s suggestion because I thought she was on the right track. The action shown below will do what you want for one of the images resulting from Crop and Straighten Photos:

 

Crop-and-Straighten-add-border.jpg

 

Here is what it does:

Canvas Size — Choose the Image > Canvas Size command.

With Relative — Use the Relative option so you can enter the difference you want in the canvas size, like 20 pixels. With the Relative option, it doesn’t matter if the originals are different sizes; they will all get the same sized border added to them.

Width and Height — Enter 20 pixels for both, so 20 pixels are added to both Width and Height dimensions.

Horizontal: center and Vertical: center — Add the new pixels from the center, for both dimensions.

Extension Color: background color — The color of the extended canvas will be the current background color, such as white. It would be safer to add another Action step at the beginning that makes sure the background color is set to white.

 

The result of that is 10 extra pixels of white border added around the current image, such as one of the images separated out by Crop and Straighten Photos. The reason it’s 10 pixels is that the 20 pixels is across the entire width or height, so half (10 pixels) gets added on each side. If you wanted 20 pixels added along both dimensions, specify 40 pixels for each dimension.

 

Select Next Document — This step is because Crop and Straighten Photos produces multiple untitled image windows, so you want to run this action on each of the new documents. This last step makes sure that after it finishes adding a white border around one document, it switches to the next document for you.

 

You might also want to add a Save As step between those two, which could set the file format and folder to save them into. But you might have to manually give each new image an appropriate name.

 

The last step you requested is Crop, but it’s not clear why that’s needed. There will be no unneeded extra area to crop. Because you’re working with documents already separated out by Crop and Straighten Photos, each is already cropped down to the image edge with a border added, and nothing outside that.

 

This is where we reach the limits of actions. You do have to manually run this for every new document created by Crop and Straighten Photos, and when you are done you still have to manually name and save all of the new documents, and finally close the original document that had multiple scans on it. This is where scripting could make this better. A script might be able to count how many open documents there are, save each one with your naming convention and then close each, then when there is only one left open (the original scan with multiple images that you no longer need to keep), close it without saving. Unfortunately I’m not good at scripting, but JJMack is extremely good at it.

Likes

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
Reply
Loading...
Most Valuable Participant ,
Aug 25, 2020

Copy link to clipboard

Copied

The thing is they do not need to add a border  the image they scan have the required boarders. What they need is a process to batch process Crop and Straighten. The way Crop and straighten works is it cuts out image in a scan and creates new documents containing the cutout images. 

 

This leaves some number of new images open in photoshop along with the opened scan.   What the Op requires after the Crop and Straiten step in the action is a script step. The script would save and close the new images to some output folder and  then close the scan document, The action will end and batch will open the next scan an the process will be repeated. Crop and straighten  Save and close. 

 

The script should not be difficult to code.  It need to have some way to know where to save the output files it could be a hard coded location.

JJMack

Likes

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
Reply
Loading...
Most Valuable Participant ,
Aug 26, 2020

Copy link to clipboard

Copied

The two step action should be able to be batched. It did a good job on a simulated scan with three copies of the 10"x 8" scan image that needed to be cut and straightened

Capture.jpg

image.png

 

JJMack

Likes

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
Reply
Loading...
JJMack LATEST
Most Valuable Participant ,
Aug 26, 2020

Copy link to clipboard

Copied

The Action batched well. It would be very easy to modify the script to add  a boarder around the scanned images.  However, IMO I see no reason to do that.  You can always print images smaller than your paper stock the printed images will have white paper boarders. I also see no reasons to scan the Images at a higher resolution than 300DPI for old prints image resolution will not be better than  300DPI. The save image will be the size of the prints scanned print at 300 DPI.

Here are the fake scans I batched processed.

image.png

JJMack

Likes

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
Reply
Loading...