as3-image-library is aÂ collection of image encoding algorithms.Â The lib currently supports the encoding process of
BitmapData into PNG and JPEG images with Pixel density (DPI). A bitmap is supplied to the lib and, according to the encoder, a
ByteArray is returned (with the encoded image data).
This lib is useful to create, for instance, drawing apps with custom export settings where the user can choose the type of the output file. If performance becomes a problem, the
BitmapData class canÂ natively compress data since Flash Player 11.3 and AIR 3.3.
var bmp_data:BitmapData = new BitmapData(500, 500, false, 0xff0000); var png:ByteArray = PNGEncoder.encode(bmp_data, 150);//150 is pixel density in inches (dpi) var jpgEncoder:JPEGEncoder = new JPEGEncoder() var jpg:ByteArray = jpgEncoder.encode(bitmap.bitmapData, 300);