Skip to main content
Participant
September 27, 2011
Question

Show image quality as like original image after resize in as3.

  • September 27, 2011
  • 1 reply
  • 1841 views

Hi Guys,

I am working on a Action Script3 project and i am showing images after resizing. I am using Bitmap and BitmapData manipulation for this but not getting image quality as like original image.  Please guide and help me with code that how can i do this.

Thanks & regards

Rangrajan

This topic has been closed for replies.

1 reply

September 27, 2011

How are you resizing? Normally, you would draw the original bitmap data into the new bitmap data, using a matrix to resize. To smooth scale, you need to use the smoothing option of the draw method. Here's a little sample that takes a library image and scales it to 500x500, using smoothing:

var orig:BitmapData = new baseMap(); //library image

var res:BitmapData = new BitmapData(500,500);

var m:Matrix = new Matrix();

m.scale(res.width / orig.width, res.height / orig.height);

res.draw(orig, m, null, null, null, true);

var c:Bitmap = new Bitmap(res);

addChild(c);

toggle the true to false in the draw, to see the difference...

Participant
September 28, 2011

thanks dmennenoh for replying me with example and code. But I am doing as like you have told and getting poor quality than oroginal image.

regards

Rangrajan

September 28, 2011

Let's see an example of your problem then. You're not going to get Photoshop quality scaling - in Flash this is scaling with the vector renderer, it's made for speed vs quality. But with smoothing on I find the scaling to be quite acceptable.