开发者

Improve image resize performance with CF

开发者 https://www.devze.com 2023-01-19 20:19 出处:网络
I\'ve a开发者_如何学Go function to resize a bitmap which is called several time (real time processing of image) and the following code is quite slow, so my app performance is \"bad\". Does anyone know

I've a开发者_如何学Go function to resize a bitmap which is called several time (real time processing of image) and the following code is quite slow, so my app performance is "bad". Does anyone know an other way of resizing image with CF which is faster ?

Image bmp = new Bitmap(size.Width, size.Height);

using (var g = Graphics.FromImage(bmp))
{
    g.DrawImage(image, 
                new Rectangle(0, 
                              0, 
                              size.Width, 
                              size.Height), 
                new Rectangle(0, 
                              0, 
                              image.Width, 
                              image.Height),
                GraphicsUnit.Pixel);
}
return (Bitmap)bmp;

Regards,


You might try using the Imaging API to create a thumbnail the size you want. I just blogged an example yesterday that covers thumbnails and clips.

0

精彩评论

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