anyone want to test out my image conversion class? So far you can set quality and image rotation for jpegs and can convert any bitmap based image to bmp, jpg, gif, tiff, or png.

any errors/problems/suggestions, please post here..here is the code with a sample sub main module you can use as an example usage..compile this using vbc image.vb /r:system.drawing.dll


Code:
Imports System
Imports System.Drawing
Imports System.Drawing.Imaging


Module App
	Sub Main()
		Dim tst As New ImageConverter()
		tst.ImagePath = "c:\ufr3.bmp"
		tst.ImageType = tst.ImageType.Jpeg
		tst.Transformation = tst.Transformation.Rotate90
		tst.Quality = 100
		tst.ConvertImage()
	End Sub
End Module

Public Class ImageConverter
	Public Enum enumImageTypes
		Bitmap = 0
		Jpeg = 1
		Gif = 2
		Tiff = 3
		Png = 4
	End Enum
	
	Public Enum enumCompression
		CCITT3 = &H00000003
		CCITT4 = &H0000004
		LZW = &H0000002
		None = &H0000006
		Rle = &H0000005
	End Enum
	
	Public Enum enumGifVersion
		Gif87 = &H0000009
		Gif89 = &H000000A
	End Enum
	
	Public Enum enumTransformation
		FlipHorizontal = &H0000010
		FlipVertical = &H0000011
		Rotate180 = &H000000E
		Rotate270 = &H000000F
		Rotate90 = &H000000D
	End Enum
	
	Public Enum enumRenderMethod
		NonProgressive = &H000000C
		Progressive = &H000000B
	End Enum
	
	Public Enum enumScanMethod
		Interlaced = &H0000007
		NonInterlaced = &H0000008
	End Enum
	
	Public ImagePath As String
	Public ImageType As enumImageTypes
	Public Quality As Integer
	Public Transformation As enumTransformation
	
	Public Sub ConvertImage()
		Dim imgExt As String
		Dim newBitmap As Bitmap = New Bitmap(ImagePath)
		Dim imgCodecs() As ImageCodecInfo  = ImageCodecInfo.GetImageEncoders()		
		' Set quality Parameter for the Jpeg codec
		Dim imgParams As EncoderParameters = New EncoderParameters(2)
		
		Dim imgQuality As EncoderParameter = New EncoderParameter(System.Drawing.Imaging.Encoder.Quality, Quality)	
		' Set quality
		imgParams.Param(0) = imgQuality
		
		Dim imgTransform As EncoderParameter = New EncoderParameter(Encoder.Transformation, Convert.ToInt64(Transformation))
		imgParams.Param(1) = imgTransform
		
		'Get file extension of codec
		imgExt = imgCodecs(ImageType).FilenameExtension
		imgExt = imgext.SubString(1, 4)' the extension comes back as *.gif, so we cut out the *
		
		' Save the image by removing the previous extension, add the new, set the codec, and set parameters
		' Image is saved to same locattion as original
		newBitmap.Save(ImagePath.SubString(0, ImagePath.Length - 4) + imgExt, imgCodecs(ImageType), imgParams)
		' Now we need to reopen the new file and resve to have parameters take affect
		newBitmap = New Bitmap(ImagePath.SubString(0, ImagePath.Length - 4) + imgExt)
		newBitmap.Save(ImagePath.SubString(0, ImagePath.Length - 4) + imgExt, imgCodecs(ImageType), imgParams)
		newBitmap.Dispose()
	End Sub
End Class