Click here to Skip to main content
13,054,615 members (63,606 online)
Click here to Skip to main content
Add your own
alternative version


58 bookmarked
Posted 25 Sep 2001

A C# Image Converter

, 3 Jan 2003
Rate this:
Please Sign up or sign in to vote.
Presenting a smal C# Windows Application for converting images between different graphical formats

Sample Image - ImagConvert.jpg


The conversion between different graphical image formats using the C# programming language and the .NET Framework is very easy in comparison with the Windows API case where no direct support for such an operation is provided. You can open any image file format from the ones specified by a group of properties of ImageFormat class:

  • Bmp - Bitmap image format (extension .bmp)
  • Emf - Enhanced Windows metafile image format
  • Exif - Exchangable Image Format
  • Gif - Graphics Interchange Format image format (extension .gif)
  • Icon - Windows icon image format (extension .ico)
  • Jpeg - Joint Photographic Experts Group image format (extensions .jpg, .jpeg)
  • MemoryBmp - Specifies a memory bitmap image format
  • Png - Specifies the W3C Portable Network Graphics image format (extension .png)
  • Tiff - Tag Image File Format (extension .tif)
  • Wmf - Windows metafile image format (extension .wmf)

ImageFormat class is in the System.Drawing.Imaging namespace. The following code snippet is showing how it is done:

string strFileName = "FileName.jpg";
Bitmap bitmap = new Bitmap(strFileName);

Later you can save the bitmap in another graphical format specifying the new file name and graphical format like in the following code snippet:

strFileName = "FileName.gif";
bitmap.Save(oStrFileName, ImageFormat.Gif);

The source code of a fully operational Image Converter application is provided in the attached project I am interested in any opinions and new ideas about this implementation.

Updates History

28 Dec 2002 - Update to VS.NET release with the code provided by M.H. Thanks!


This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


About the Author

George Anescu
Web Developer
Romania Romania
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralI tried to convert a EMF format file to a Bitmap file. the background turns to black Pin
hawkgao012925-Jul-10 20:35
memberhawkgao012925-Jul-10 20:35 
GeneralMy vote of 1 Pin
Guy Baseke21-Sep-09 4:24
memberGuy Baseke21-Sep-09 4:24 
QuestionUsing Win32 calls for Image conversion. Pin
kavitesh1-Apr-08 20:57
memberkavitesh1-Apr-08 20:57 
QuestionOverwrting the file casues JIT Error Pin
waliaps14-Dec-06 5:11
memberwaliaps14-Dec-06 5:11 
QuestionQuery Pin
mak_gh22-Feb-06 19:58
membermak_gh22-Feb-06 19:58 
Generalgif patent expired Pin
raloth45627-Aug-04 10:38
memberraloth45627-Aug-04 10:38 
GeneralOther formats Pin
Anonymous8-Mar-02 2:16
memberAnonymous8-Mar-02 2:16 
GeneralRe: Other formats Pin
Christian Graus4-Jan-03 1:02
memberChristian Graus4-Jan-03 1:02 
GeneralWhich version of Framework Pin
Anonymous17-Oct-01 7:23
memberAnonymous17-Oct-01 7:23 
General[Message Deleted] Pin
Anonymous30-Aug-02 9:36
sussAnonymous30-Aug-02 9:36 
GeneralRe: Which version of Framework Pin
George Anescu28-Dec-02 11:09
memberGeorge Anescu28-Dec-02 11:09 
GeneralGIF Pin
Chris Losinger26-Sep-01 4:46
memberChris Losinger26-Sep-01 4:46 
GeneralRe: GIF Pin
George Anescu26-Sep-01 5:41
memberGeorge Anescu26-Sep-01 5:41 
GeneralRe: GIF Pin
Anonymous5-Oct-01 11:23
memberAnonymous5-Oct-01 11:23 
GeneralRe: GIF Pin
Chris Losinger5-Oct-01 12:32
memberChris Losinger5-Oct-01 12:32 
GeneralRe: GIF Pin
Anonymous11-Oct-01 6:11
memberAnonymous11-Oct-01 6:11 
GeneralRe: GIF Pin
Christian Graus4-Jan-03 0:59
memberChristian Graus4-Jan-03 0:59 
GeneralRe: GIF Pin
Mike Stevenson11-Oct-01 6:24
memberMike Stevenson11-Oct-01 6:24 
GeneralRe: GIF Pin
Christian Graus4-Jan-03 1:00
memberChristian Graus4-Jan-03 1:00 
GeneralRe: GIF Pin
fadi9-Jan-02 8:43
memberfadi9-Jan-02 8:43 
GeneralGIF: wrong. Pin
Chris Losinger9-Jan-02 8:50
memberChris Losinger9-Jan-02 8:50 
GeneralRe: GIF Pin
rendle4-Apr-02 5:26
memberrendle4-Apr-02 5:26 
GeneralRe: GIF Pin
abstractsagacity20-Aug-04 23:07
memberabstractsagacity20-Aug-04 23:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 4 Jan 2003
Article Copyright 2001 by George Anescu
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid