Mark Andrews
Mark Andrews

Reputation: 15

Image Filters/ByteArray

I am using pixel bender's pbj files(as recommended with Flex4) to change the brightness/contrast of a image.So i apply the filters to the image like this:

image.filters = myBitmapFilter;

Now my problem is how to fetch the byteArray of the image with filter applied so that i can send bytearray to my servlet which can save the image with applied effects. Please provide suggestions.

Upvotes: 0

Views: 260

Answers (1)

JeffryHouser
JeffryHouser

Reputation: 39408

I see two options. First, get the bitMapData. You should be able to get this:

var myBitMapData : BitMapData = image.bitMapData

If not that, can you use the imageDisplay skin Part, which is a BitMapImage?

var myBitMapData : BitMapData = image.imageDisplay.bitMapData

[Caveat; I'm not sure if the filters will be applied in either situation].

Once you have that BitMapData, you can get a ByteArray using the getPixels method:

var myByteArray : ByteArray = myBitMapData.getPixels(new Rectangle(0,0,image.width,image.height ));

Upvotes: 0

Related Questions