.NET GDI+ - Convert BitMap To Jpeg

This VB.net application will select all the bitmap images in that particular folder and convert them to jpeg and store the jpeg images in the same folder.

This tool is developed in vb.net.
Its a useful tool to convert the BMP image into the JPEG.

Select the folder from which you want to take the bmp image. 
the tool converts the bmp into jpeg and creates the jpeg in the same folder. 

--------------  Folder Selection
Dim d, fname
d = System.IO.Directory.GetFiles(FolderBrowserDialog1.SelectedPath & "\", "*.bmp")
Dim en As System.Collections.IEnumerator
en = d.GetEnumerator
While en.MoveNext
fname = en.Current
End While
-------------- Folder selection end here

the above code simply select all the mbp file from the selected folder.
then it loop threw all the selcted bmp and the name of the file
will be passed to the function called Convertimage. --------- Convert Function Function Convertimage(ByVal fname As String) Dim thumbimage As New Bitmap(fname) Dim thumbimage1 As Bitmap Dim width As Int16 = 135 Dim height = ((135 / thumbimage.Width) * thumbimage.Height) ' Dim width1 As Int16 = 450 ' Dim height1 = ((450 / thumbimage.Width) * thumbimage.Height) thumbimage1 = thumbimage.GetThumbnailImage(width, height, AddressOf ThumbNailAbort, Nothing) Dim newimagename As String = Replace(fname, "
.bmp", ".jpeg") thumbimage1.Save(newimagename, System.Drawing.Imaging.ImageFormat.Jpeg) thumbimage1 = Nothing End Function --------- Convert Function this function converts the bmp image into the jpeg and resizes the image
and sets the image width to 135 px the height of the image will be
porportionate to width of the image.
By Umesh Gaikwad   Popularity  (6467 Views)