mercredi 24 février 2016

Reducing png file size in as3

I tried to reduce the size of the png file in AS3

I used mLoader to load the png file and got the png's bitmap

public function savePng(bitmap:Bitmap,scale:Number):void
  var bitmapData:BitmapData = new BitmapData(bitmap.width*scale,bitmap.height*scale);
  bitmapData.drawWithQuality(mLoader,new Matrix(scale,0,0,scale), null, null, null , true, StageQuality.BEST);
  var pngEncorder:PNGEncoder = new PNGEncoder();
  var bytes:ByteArray = pngEncorder.encode(bitmapData);

But when I saved the image,it appeared jagged. I also used nid.image.encoder.PNGEncoder and PNGEncoder2,they were all useless.

Aucun commentaire:

Enregistrer un commentaire