You can do it as follows:
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded)
loader.loadBytes(byteArrayData);
-
function onLoaded(e:Event):void
{
var loader:Loader = Loader(e.target.loader);
var bitmapData:BitmapData = Bitmap(e.target.content).bitmapData;
width = bitmapData.width;
height = bitmapData.height;
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onLoaded);
}
The disadvantage is that the whole image will be decoded, so if you really do not need the image, but only the width and height, you can really look into an array of bytes and decode the file format. (More complicated, but
source
share