C# .NET : Is using the .NET Image Conversion enough?

Posted by contactmatt on Stack Overflow See other posts from Stack Overflow or by contactmatt
Published on 2010-04-20T04:42:13Z Indexed on 2010/04/20 4:43 UTC
Read the original article Hit count: 359

I've seen a lot of people try to code their own image conversion techniques. It often seems to be very complicated, and ends up using GDI+ funciton calls, and manipulating bits of the image. This has got me wondering if I am missing something in the simplicity of .NET's image conversion call when saving an image. Here's the code I have

Bitmap tempBmp = new Bitmap("c:\temp\img.jpg");
    Bitmap bmp = new Bitmap(tempBmp, 800, 600);
    bmp.Save(c:\temp\img.bmp, //extension depends on format
        ImageFormat.Bmp) //These are all the ImageFormats I allow conversion to within the program.  Ignore the syntax for a second ;) 
        ImageFormat.Gif) //or 
        ImageFormat.Jpeg) //or
        ImageFormat.Png) //or
        ImageFormat.Tiff) //or
        ImageFormat.Wmf) //or
        ImageFormat.Bmp)//or
        );

This is all I'm doing in my image conversion. Just setting the location of where the image should be saved, and passing it an ImageFormat type. I've tested it the best I can, but I'm wondering if I am missing anything in this simple format conversion, or if this is suffice?

© Stack Overflow or respective owner

Related posts about c#

Related posts about image-conversion