# Serializing BitmapData to ByteArray (AMF)

**URL:** <https://forum.kirupa.com/t/serializing-bitmapdata-to-bytearray-amf/296339>\
**Category:** flash\
**Created:** [September 13, 2009, 10:01pm UTC](https://forum.kirupa.com/t/serializing-bitmapdata-to-bytearray-amf/296339 "2009-09-13T22:01:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wvxvw](https://avatars.discourse-cdn.com/v4/letter/w/a9a28c/32.png) [@wvxvw](https://forum.kirupa.com/u/wvxvw)\
**Post date:** [September 13, 2009, 10:01pm UTC](https://forum.kirupa.com/t/serializing-bitmapdata-to-bytearray-amf/296339/1 "2009-09-13T22:01:55Z")

</div>

I wonder if it is possible to serialize an instance of BitmapData to ByteArray (I don’t want to convert it to anything, so, no JPEGEncoder / PNGEncoder etc).

For now it seems that when you serialize BitmapData using standard procedure, i.e. by registerClassAlias(“extendingBitmapDataClass”), I will only get an object with the reference to the resource, but not the resource itself, so, this may work inside one SWF but not between 2 SWFs.

Why do I need this:

- imagine, Alchemy JPEGDecoder would write an instance of BitmapData class instead of spitting out the array of pixels…
- or, a server script will create, again, an instance of BitmapData, and send a ready-to-use AS class, instead of an image. (Flash Player isn’t superfast to read downloaded images…), besides, so far the Flash client is a weak link, so the server script has a lot of “spare” time to do that stuff instead…
