CS6 Photoshop Autocrop Around Object in Image & Add Margin?

I take photos of various objects on a one color background (gray or black).


I save photos as psd images with the "Delete cropped pixels" disabled so I can redo the crop at a future date if needed.


I enlarge the image to full size and move the crop tool so it touches the outer edges of the image.


I then crop the image.


I then add a given amount of pixels on each side by resetting the size of the canvas.


The purpose of this is to maintain a consistent margin around every object so when the images are published online they have a much better appearance.


This is time consuming and was looking for a faster method.


Since all the objects are different a script would not really work as cropped area is going to be different for each image.


Are there any PS plugins which can recognize a single object within a image, add a given margin around the object, and then crop the image? PS's own File > Automate > Crop & Straighten Photos is utterly worthless to the nth degree.

Mac Pro, macOS Sierra (10.12.5)

Posted on Apr 19, 2018 12:51 PM

Similar questions

13 replies

Apr 20, 2018 7:39 AM in response to kahjot

Yes, assuming you've set it for enough save states to go back that far. But I meant, why put a crop factor on the original at all? If you need a new crop that shows more than your current factor, then you need to waste time opening up the area, then re-crop it, instead of simply creating the crop you want in one move. That, and it doesn't save any disk space. The factor simply hides the unviewed pixels.

Apr 20, 2018 8:07 AM in response to kahjot

That would not really be an option. I was likely not clear enough in my explanation.


Imagine a antique porcelain vase on a black background. The "margins" I am referring to are the distance between the outer edges of the vase and the edges of the crop. This would be equivalent to the CSS padding.


The psd files act as my master file which I archive.


I batch process groups of psd files through a bulk watermarking app. This app creates a copy of each image which it watermarks, resizes, changes the resolution for web display. It then saves each copy as a jpeg by appending a "-w" to the end of the original file name. The original psd file is not touched. After articles are published the watermarked copies can be deleted as they can be generated at a future date again.


The real time bottleneck is manually placing the crop tool on the outer edges of a object within the image and then adding padding around the object by increasing the canvas size by given size. I've added a action to PS add the padding by increasing the canvas size.


What I really need is a PS plugin to automatically recognize a object in the image and then crop that image after adding a given margin around the object. There is a similar feature in some scanner software whereas it automatically detects the edges of a photo you wish to scan against the white background of the scanner lid. What I am looking for is more difficult in that any software would be trying to detect the borders of a non-rectangle shaped objects on background whose coloring gradually changes due to lighting.

Apr 20, 2018 9:21 AM in response to Kurt Lang

I built a small app in Realbasic (later Real Studio, Xojo) a number of years ago to do something similar. I had a series of small images consisting of black text on a white background. I wanted these images trimmed so as not to include any empty white space below, above, or on the sides of the actual text.


This app scanned the rgb value of each pixel in a image, looking for pixels which were not white. If a non white pixel was found it compared its x and y coordinates within the picture to four properties which stored the x and y coordinates of the highest, lowest, farthest left, and farthest right non white pixel found so far. When the scan was completed the four properties represented the crop frame.


This could be adapted in some situations if I were using a green screen for a background as there would be a high contrast between the background and object; however, I need to use black or gray background. There are also subtle changes in those backgrounds due to lighting.

Apr 20, 2018 6:08 PM in response to Kurt Lang

Thanks for all the input!


Probably stuck with manually moving the crop frame for now; however, this has been speeded up by using either Apple's built-in magnification or Pixie from the developer tools.


Without these apps the only way to correctly place the crop frame would be to open each image at 100% (5,184 pixels wide) and scroll to the top, bottom, left, and right to move the crop frame into position.


With these apps I can open the images in PS at the default 25% on my left screen and open a magnification app on the left edge of my right screen. The magnification app is set to 4x (full size) so this allows me to quickly position the crop frame within PS.


Adapting the previous app I made would take some further work as I'd have to establish two tolerance settings that tell the app what exactly are the rgb pixel ranges for a black or gray background so as not to confuse it with the object on top of the background. Dealing with shadows cast by the object would be a big headache as they are often barely present and would be nearly the same rgb pixel value as the nearby background.

Apr 20, 2018 6:13 PM in response to Eric Root

I'll try that. Nice to see their forum is accessible again.


I haven't been using there forum for some time as the last time I attempted to use it Safari gave a error message saying the site was not properly configured. I tried a couple other browsers and that did the same even after logging in. Called Adobe and their answer was to try another browser as opposed to fixing their site coding.

Apr 20, 2018 8:11 AM in response to Community User

What I really need is a PS plugin to automatically recognize a object in the image and then crop that image after adding a given margin around the object. … What I am looking for is more difficult in that any software would be trying to detect the borders of a non-rectangle shaped objects on background whose coloring gradually changes due to lighting.

That is going to be impossible to find. Such software would practically need to be sentient so it can recognize a vase, stuffed toy, etc., so it can determine what's object, and what's background. And from there, know where to place the crop.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

CS6 Photoshop Autocrop Around Object in Image & Add Margin?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.