开发者

Creating gif/bmp files with flex

  public function bmdToStr(bmd:BitmapData,width:int,height:int):String {
   var encoder:JPEGEncoder = new JPEGEncoder();
   var encBytes:ByteArray = encoder.enc开发者_运维知识库ode(bmd);
   return ImageSnapshot.encodeImageAsBase64(new ImageSnapshot(width,height,encBytes,"image/jpeg")); 
  }

As of now, I am creating JPEG image from bitmapdata as above.

I can use PNGEncoder for creating png images as well.

How do I create .bmp or .gif files?


why would you create BMP? and for the same matter, why would you create a GIF?

the only interesting thing about GIF is, it supports animation. apart from that it's simply deprecated. if you want lossless compresion use PNG, if size is more important, use JPG. if it is really animation you want, I suggest you have a look at GIF Animation Encoder.

and BMP is totally not worth any consideration. it's just huge for 24 bit images (32 with transparency). an image 800x600 will result in 1.4 MB. BMP offers no advantages except the fact that it doesn't require decompression for display, but nowadays this makes virtually no difference, especially for the web.

if you really think, you need it, then you should simply lookup bmp specs. it's really straight forward.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜