开发者

Improve image resize performance with CF

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜