views:

9

answers:

1

Hi,

I've a 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,

A: 

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.

ctacke