The Code is as follows:
Image Format Conversion
Public void ImageFormatter (string sourcePath, string distationPath, string format ){
System. Drawing. Bitmap bitmap = new System. Drawing. Bitmap (sourcePath );
Switch (format. ToLower ()){
Case "bmp ":
Bitmap. Save (distationPath, System. Drawing. Imaging. ImageFormat. Bmp );
Break;
Case "emf ":
Bitmap. Save (distationPath, System. Drawing. Imaging. ImageFormat. Emf );
Break;
Case "gif ":
Bitmap. Save (distationPath, System. Drawing. Imaging. ImageFormat. Gif );
Break;
Case "ico ":
Bitmap. Save (distationPath, System. Drawing. Imaging. ImageFormat. Icon );
Break;
Case "jpg ":
Bitmap. Save (distationPath, System. Drawing. Imaging. ImageFormat. Jpeg );
Break;
Case "png ":
Bitmap. Save (distationPath, System. Drawing. Imaging. ImageFormat. Png );
Break;
Case "tif ":
Bitmap. Save (distationPath, System. Drawing. Imaging. ImageFormat. Tiff );
Break;
Case "wmf ":
Bitmap. Save (distationPath, System. Drawing. Imaging. ImageFormat. Wmf );
Break;
Default: throw new Exception ("this format cannot be converted! ");
}
}