Posted: Sun Jun 16, 2013 4:34 am Post subject: Ahhh... Help. Need to automate selection of 100s of similar
I have hundreds of avatars created with avatar software. Unfortunately it stupidly adds a website name, tons of space and a shadow under the avatar. All of which I want to remove.
The image sizes are all the same, however also unfortunately the location of the shadow, the website name and space around the avatar all change based on the size of the avatar.
I need a way to automate grabbing just the avatar (no space, no text, no shadow) and saving it.
What I need is an action or script that can select out to the edges of the avatar...Example, automate starting with a small selection box and have it expand until it hits the edges, then copy selection and save.
Or possibly a script/action that will select everything except for the exact color of the shadow and website text. I'm not sure which is the better method or which is easier, or if the first method is even possible without tons of scripting. Also, the second method could potentially not select colors within the avatar that are the same as the shadow or text colors....
I've attached 2 samples. Any ideas to automate this?
Okay... I figured it out after about 3 hours of trial and error. It's not perfect, but it should work very well for 95% of the images.
I used color picker to remove the shadow. Before using color picker, I selected the bottom 1/5th of the image (even if some shoes were included... This was necessary because the avatars are of different lengths and wanted to make sure I caught the shadow in all images). I didn't select the whole image because this would select parts of the avatar as well with color picker. Obviously something may still be caught in some of the avatars shoes if grey, but with my test images, it wasn't a problem.
Refine edge and expand a bit to catch the whole area of shadow. Perhaps smart edge detection would be a better choice, Fill color-picked selected shadow with white.
Select bottom area where website name is and fill with white. This MAY be an issue too with the very tall avatars, some of their feet may get cut off, but so far no issue with the test images I've used.
Select white with magic wand, and clear. necessary because the background is white, not transparent and want transparent background.
inverse selection
Crop
Reduce size
Save
.... Haha... Anyone has a better way... Please let me know. I goofed around for so long before refining it to this... It seems very good so far....and was damn near giving up.
To get rid of site name:
1. Image->Trim... (Bottom right pixel color, trim away Bottom side)
2. Image->Canvas size, relative - check. Height - -30px, Vertical - top.
Again Image->Trim... (Bottom right pixel color, trim away Bottom)
Now to get rid of the shadow:
1. Flip Vertical
2. Magic Wand at 400 px, 5 px
3. Select->Modify-Expand: 4px,
4. Fill selection with white,
5. Deselect,
6. Flip Vertical,
7. Image->Trim... (Bottom right pixel color, trim away all sides)
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum