Skip to main content
November 28, 2012
Question

Batch trim transparent from images hindered by small artifacts

  • November 28, 2012
  • 1 reply
  • 1854 views

I have downloaded a lot of trees and people for use in image editing. (from places like vyonyx.com)

I am now converting all of these into a cad program (long story but just context for you!)

But I have a problem, I need to batch trim all the images to the bounding box of the actual image but the trim is currently being stopped because there are small patches of non-transparent pixels around as the images weren't originally cut out "properly".

Also, I cannot use a batch canvas size crop because they are all different sizes.

I need to trim the canvases of about 300 images to match a live trace of each of them.

suggestions:

either a way remove small patches of unwanted pixels

or

open the .ai illustrator file (contains a live trace, which I want the psd to match up to), trim the canvas, insert the associated .png file (same file name but different extension) at the same size. delete the .ai live trace silhouette layer, then save as a compressed .png and close.

I have been using actions but never scripted so very much a beginner for scripting here - if scripting is even needed.

Thanks for your help,

Luke.

This topic has been closed for replies.

1 reply

Inspiring
November 28, 2012

Have you looked at using trim instead of crop…? Are these islands of unwanted data all over the place…?

November 28, 2012

yes and yes.

trim obviously trims to the extents of the image which includes the unwanted data which extends beyond the extents of the image I want to trim to.

Yes they are random from what was not originally cut out very well. - Probably used background eraser or somethang rather than cutting properly