13 Replies Latest reply on Sep 21, 2017 8:08 AM by JJMack

    Photoshop: Disable straighten for batch crop and straighten

    234542f344d654165e

      Hello!

       

      Is there any way to configure Photoshop to only do crop with the File-Automate-Crop and Straighten Photos? Within the script with some parameters?

       

      I am using it with a script in ExtendScript Toolkit and it work superbly fast, but my problem is that I need to crop rounded objects from white/grey background and they are already oriented correctly. This tool rotates them in 60% wrong way and result is unusable and I have to do them manually.

       

      I tried to use Photoshop Trim tool, but it is not able to crop the image because the background is not ideal white.

       

      I also tried using ImageMagick and Gimp, but neither of them is able to process images with such background.

       

      Thank you.

        • 1. Re: Photoshop: Disable straighten for batch crop and straighten
          JJMack Most Valuable Participant

          When you want ask a question where you would like to get some replies that may be of use.  You should provide information the allows users to know what your dealing with.  Without any example images I do not believe you will get much help

          • 2. Re: Photoshop: Disable straighten for batch crop and straighten
            234542f344d654165e Level 1

            Hello!

             

            I am sorry, I can not understand your first sentence.

             

            My question is essentially in the subject - I need to disable "straighten" part of the Photoshop process "Crop and Straighten Photos".

             

            Everything else is elaboration on the topic.

             

            I add example images.

             

             

            1. INPUT IMAGE

            input.JPG

             

            2. GOOD RESULT (manual crop)

            good.JPG

             

            3. BAD RESULT (Crop and Straighten Photos-function)

            bad.JPG

            • 3. Re: Photoshop: Disable straighten for batch crop and straighten
              Chuck Uebele Adobe Community Professional & MVP

              I believe the crop and straighten is a plugin, and I don't think it can be modified to what you want it to do.

              • 4. Re: Photoshop: Disable straighten for batch crop and straighten
                JJMack Most Valuable Participant

                Yes you are using the wrong tool.  No simple application would be able to straighten that image.  What you seem to be trying to do is trim  to an Object bounds.  If the background is a quite consistent color and the object's edges have a high contrast to the color. You may be able to automate that process with a Photoshop script perhaps an action may be able too but likely it would requite scripting.  I want to stress May. It depends on being able to select all pixels outside the object  It will not matter if pixels inside the object are also selected as lone are the object edges are not selected.

                 

                If you create a new top layer that contains the documents composite. If it just a background layer duplicate so the top layer is a normal pixels layer.  Your Process would then select the background in that work layer. You could try different methods to see which methods works best with your background types.   Select all convert  the selection to a path and stroke the path with the quick selection  tool.  Use the magic Wand,    Use color range.   You want to select all the pixels  outside the object fully selected and none of the object outer edge pixels at all.   If you can make that selection you will be able to crop your image.  You would delete the selected pixels in the work layer you created.  You would then get the work layer new bounds and crop the document to the layers bounds or a little larger to leave a little background, 

                1 person found this helpful
                • 5. Re: Photoshop: Disable straighten for batch crop and straighten
                  234542f344d654165e Level 1

                  Thank You for your thoughts. That is exactly that I am afraid of that the only way to program. I have tried to solve this by automation, but still for last 13 years the best result has been manual work.

                  • 6. Re: Photoshop: Disable straighten for batch crop and straighten
                    234542f344d654165e Level 1

                    So far my research indicates the same, but even though I have been using Photoshop since its beginning I do not use many of its features and I thought that perhaps there is a silver bullet - in Photoshop configuration, some key to hold down, some hidden property or parameter in the scripting.

                     

                    But thank you.

                     

                    Perhaps the original plugin writer hears me and offers a plugin with crop only.

                     

                    It is funny that the crop part works almost perfectly, but I find no replicas of it in Photoshop or other software I mentioned abovet that would work even closely so well in given circumstances.

                    • 7. Re: Photoshop: Disable straighten for batch crop and straighten
                      JJMack Most Valuable Participant

                      It the background are like you showed an Action was able to do the one you posted.  It first cropped out the ruler acre recorded an action.  I the ran the action on your image without the ruler and with the ruler.  The action worked on both images.  The tricky part is using delete twice.  This seems to be required in actions and scripts to get clear to work.  It take two.

                      Capture.jpg

                      1 person found this helpful
                      • 8. Re: Photoshop: Disable straighten for batch crop and straighten
                        234542f344d654165e Level 1

                        Thank you. I will take this solution and try to enhance it. I need to get it scripted or automated as I need to process thousands of images each month.

                        • 9. Re: Photoshop: Disable straighten for batch crop and straighten
                          Katie Houghton Adobe Community Professional

                          If the color was solid then you could use Image>Trim and then set the trim based on the 'Top Left Pixel Color' or the 'Bottom Right Pixel Color' but your background is not a solid color so this is not an option.

                           

                          If you did not have the extra element (ruler), then you could create your own automation. You would have to play around with the action to see how well it does then I assume there will still be some you need to get by hand. (This action was created for your image minus the ruler):

                          1. Record the action.
                          2. Select the color of the background (Choose the top right of the image where there was only background.) I had to up the default tolerance from 32 to 34 to get your lighter area on the top left. I could have selected from the top right of the image if I had set the sample size to 5x5.
                          3. Inverse the selection
                          4. Crop based on selection.
                          5. Stop recording.
                          6. You can run this through the bridge (Tools>Photoshop>Batch) or create a droplet of the action. (File>Automate>Create Droplet)

                           

                          Not sure this will help you unless most of your images do not have the extra elements in the photo. (If the element is in the same area, you could crop that out first using the action.)

                           

                          Screen Shot 2017-09-20 at 2.02.08 PM.png

                          • 10. Re: Photoshop: Disable straighten for batch crop and straighten
                            JJMack Most Valuable Participant

                            If the action works one your other images you could use menu File>Automate>Batch and batch all your image with the action.

                             

                             

                            That action doe nor work on my machine in CC 2017 there  is a program problem stroking a path with the quick selection tool. I use CC 2014

                            • 11. Re: Photoshop: Disable straighten for batch crop and straighten
                              234542f344d654165e Level 1

                              Thank you for your thoughts.

                               

                              I tried something similar, but I failed in defining the background "fuzzyness" - whatever I set the tolerance, it pretty much only worked with very light grain. Again - for some reason the C&S tool manages all images, so I wonder what is the magic behind the crop.

                               

                              I have ruler on all the images as I need to keep original measures intact even though for catalogue I need just the coins. Background varies, yes, due to photo quality and photographer skills. Some coins can not be shot with too much light or I lose important details.

                               

                              I could cut the ruler away with a separate batch but the sizes of coins and ruler vary.

                               

                              Right now I get 40-50% done with a script that runs the photos through the crop and straighten (I store only first image as the rest are obsolete images) and then manually do the rest of images.


                              But there has to be a way.

                              • 12. Re: Photoshop: Disable straighten for batch crop and straighten
                                Katie Houghton Adobe Community Professional

                                Add a feature request for Photoshop: Feature Request/Bug Report Form

                                1 person found this helpful
                                • 13. Re: Photoshop: Disable straighten for batch crop and straighten
                                  JJMack Most Valuable Participant

                                  Here is the Action I recorded that worked on your coin image.  It uses the quick selection tool stroke around the canvas border.  It may not work if you are using CC 2017.  When I try Stroking a Path with the Quick selection tool on my Windows 10 preview build and CC 2017  Photoshop displays there was a Programs Problem and the actions stops.  The Action works well in CC 2014 the version I use.

                                   

                                  http://www.mouseprints.net/old/dpr/Test_Set.atn