I'm encoding the BitmapData using this method: http://www.websector.de/blog/2009/06/21/speed-up-jpeg-encoding-using-alchemy/
Code example:
var loader:CLibInit = new CLibInit;
as3_jpeg_wrapper = loader.init();
var baSource: ByteArray = bitmapData.clone().getPixels( new Rectangle( 0, 0, WIDTH, HEIGHT) );
var baAlchmey: ByteArray = as3_jpeg_wrapper.write_jpeg_file(baSource, WIDTH, HEIGHT, 3, 2, quality);
After encoding i need to convert resulting byteArray back to BitmapData. I'm using setPixels()
method.
For example:
baAlchemy.position = 0;
var bd:BitmapData = new BitmapData(width, height);
bd.setPixels(rect, baAlchemy);
And i get "Error #2030: End of file was encountered?".
Can anybody help me?