开发者

Flex (Flash Builder 4) modify image, keep quality

开发者 https://www.devze.com 2023-01-08 20:20 出处:网络
I\'m writing an simple application for users to upload an image, modify it and save it back to the HD.

I'm writing an simple application for users to upload an image, modify it and save it back to the HD.

Because most images are bigger than the image view of the app, they are scaled to fit. When te image is modified, it will be saved to the disk. At this point the quality of the image is bad.

Is it possible to scale an image for display but keep the quality?

Code i'm using now:

var loader:Loader=Loader(event.target.loader); 
var bmp:Bitmap = new Bitmap();
bmp = Bitmap(loader.content);

var 开发者_运维百科widthScaleRatio:Number = 600 / bmp.width;
var heightScaleRatio:Number = 400 / bmp.height;

bmp.scaleX = scaleRatio;
bmp.scaleY = scaleRatio;

// THEN SAVE TO THE DISK


Try to enable the smoothing, like this: bmp.smoothing = true;

0

精彩评论

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