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

Crop And Straighten Photos - Changing parameters / Editing Script

New Here ,
Jul 17, 2008 Jul 17, 2008
Hi. I am currently using the Crop and Straighten Photos automation to crop scans of 10 to 12 maps that are scanned on a large flat bed scanner.

A lot of the plans have rough edges and aren't always completely square. Is it possible to allow a tolerance (eg. 5mm, or 20pixels etc) before cropping each image? I've tried editing a .jsx script that was submitted on this forum (the script was designed to crop more border from the image, as opposed to leaving more image) but this simply added a black border around my image as it enlarged the canvas side once the image had already been cropped.

Instead, I need the selection area to be increased prior to cropping.

Does anyone have an idea on whether I can get a script to do what I am looking for?

Furthermore, if two or more of the maps are joined at all by a hair or a frayed string of canvas from the map's backing then the Crop and Straighten Photos automation considers it to be one map and crops it as only one image. Is there a way of increasing this tolerance to make the cropping process more brutal so to speak?

Any help would be greatly appreciated.
TOPICS
Actions and scripting
1.2K
Translate
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
Adobe
Community Expert ,
Jul 19, 2008 Jul 19, 2008
Im lousy at Scripting myself so I try to work around difficult Scripting-problems with Actions; as I dont see how I could edit the Crop and Straighten-Plugin I thought that depending on the color of the background You might set up an Action something like this:
Duplicate Layer
run the filter Maximum (if the background is black) with 40 pixels
 under Select run Color Range and set it to the background color with a low fuzziness
 run Select  Modify  Expand with 10 pixels
 Mask the filtered layer, thus creating an offset line around Your images that should then be included in the cropping process; and if the Maximum- and Expand-values were big enough that should also take care of the hairs and strings
 Flatten
run the Crop and Straighten-Plugin

Of course the resulting files would have the additional contour visible  but one could then run an Action (Canvas Size -60 pixels relative) on all the individual images.
(Naturally all the numbers depend on the image and the maps edges.)
And unfortunately the accuracy of the Straightening suffers a bit in the whole process.

Well, I hope I havent wasted Your time completely.
Translate
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 ,
Jul 23, 2008 Jul 23, 2008
Hi christoph.

Thanks so much for your help. I had to slightly modify it as when it "Crop and Straightened" as above it seemed to ignore the selection for some reason. I also removed the "Maximum" step as I am using a light background.

I now:
* Duplicate
* Select Color Range (fuzziness 25)
* Expand Selction by 25 (removes hairs but clips image)
* Inverse Selection
* Expand Selection by 50 (negates the clipping of image and leaves 25 pixel around image)
* Inverse Selection (Select the waste background)
* Flatten
* Delete Selection
* "Crop and Straighten Photos"
* Save and close all.

Thanks so much for your help. If you have any ideas of simplifying my process I'd like to hear it as well. Currently I am scanning up to 35 scans a day of 9 images in each scan, so this process is going to save a lot of manual cropping.

Thanks again. Much appreciated!
Translate
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 Expert ,
Jul 23, 2008 Jul 23, 2008
Like I mentioned Im not an experienced Scripter, but if I understand Photoshop-Scripting correctly You might be able to record all those steps with the ScriptingListener-Plugin (but dont forget to remove it from the PlugIns-folder after recording) and then add some lines that may make the naming/saving-process more convenient, because with an Action You probably have to save the resulting files individually, dont You?
One concern is if the scanned maps contain areas of similar color to the background that may get deleted.
Other than that I think You have straightened the process nicely, only now arent the Duplicate and Flatten wholly unnecessary?
Translate
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 ,
Jul 24, 2008 Jul 24, 2008
LATEST
Hi Christoph.

I'd realised that once i made the post, and yes, the duplicate and flatten parts in the process are unnecessary, they have been removed. The action is set up now so that once it crops the individual images, it closes the main image down, and then saves and closes the individual images. It is setup to save and close 12 images (as this is the most there will ever be in my case), and I set the action to post errors to a log rather than halt, so if there are less than 12 files it will continue and just post an error in the file. It works really well now thanks!!

I then run an action that options each individual file and brings up the "save as" dialog. This is a chance to perform a QA on the image and to save it as the correct name on the plan.

However, the action is currently setup so that it creates a complete new image each time and closes the original. This is the only way I can make the "Save as" dialog point to the new destination as if I simply open and "save as" the original files, the default folder always resets back to the original folder where the cropped images are. I'll have to investigate other methods of opening and renaming the images to help speed this part of the process up.

Thanks so much for your effecient responses. They have been a great help!

Cheers.
Translate
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