blog
Tag Archive for encoding at Jozef Chúťka's blog
October 15, 2009
Bitmap BitmapData ByteArray converting DisplayObject encoding image Loader LoaderInfo url URLRequest
Bitmap, BitmapData, ByteArray…

Lets see how to convert between Bitmap, BitmapData and ByteArray in few examples:
DisplayObject to BitmapData
BitmapData to Bitmap
BitmapData to ByteArray
URL (image) to ByteArray (asynchronous)
URL (image) to BitmapData (asynchronous)
ByteArray to BitmapData (asynchronous)
October 9, 2009
alchemy asynchronous Bitmap BitmapData ByteArray converting encoding image jpeg JPEGEncoder
ActionScript 3 encoding JPEG, alchemy
Lets assume you want to save an image (or any DisplayObject) from flash to disk, or upload to facebook etc. What you need is to encode your BitmapData into an Jpeg and send ByteArray raw data to be saved/uploaded. There are few ways how to do it.
First, you can use original adobe mx.graphics.codec.JPEGEncoder. Sadly, this encoder is the slowest. There were attemps to make it faster by otpimizing code by bytearray.org, that resulted into two times faster org.bytearray.images.JPEGEncoder. Usage is pretty simple: