In the end, I came up with the solution below, most likely not the most efficient way, but it works.
private function trimTransparency(input:BitmapData,colourChecker:uint = 0x00FF00):Bitmap {
var orignal:Bitmap = new Bitmap(input);
var clone:BitmapData = new BitmapData(orignal.width, orignal.height,true,colourChecker);
clone.draw(orignal);
var bounds:Rectangle = clone.getColorBoundsRect(colourChecker, colourChecker, false);
var returnedBitmap:Bitmap = new Bitmap();
returnedBitmap.bitmapData = new BitmapData(bounds.width, bounds.height,true,0x00000000);
returnedBitmap.bitmapData.copyPixels(orignal.bitmapData,bounds, new Point(0,0));
return returnedBitmap;
}
source
share