I have a Flash fla file that contains a whole lot of images. The majority of each image is composed of transparent pixels with a visual object in there somewhere. Each image at the moment is at {x:0, y:0}.
I want to trim away the transparent pixels of the image down to a minimum bounding box, but keep the object at the same global position. This requires shifting the trimmed image to the global position of the object in the untrimmed image.
This is not so much a problem, but the fact that the images are all contained in a fla is the problem. The options I see at the moment are:
investigate JSFL, the Bitmap object has a getPixels, this in combination with a selection and delete operation could work
save the fla to xfl and enumerate the images and associated xml with something like Ruby + image processing lib
Questions:
- Does anyone know upfront if this operation is possible in JSFL?
- Have anyone done much automated processing of xfl files?
- Is there an off the shelf image processor that can perform this trimming operation?
You might want to try doing the trimming automatically in ActionScript as the images are being used. Color shift the image to a single color and using the pixel methods to identify the bounding area. It's a similar technique used here.