PradeepYadhav
asked on
Image conversion bmp to jpg,gif,tif,png,bmp
I have a picturebox which has a bmp image i want to convert the bmp image into gif,jpeg,tif,png format.I searched the web for this, i found few dlls.Those dlls are eval,retail copies.Using these copies i cant build a exe.Can i have a code that converts bmp to gif,jpeg,tif,png so that i can build an exe.
Thanks in advance.
Thanks in advance.
Have a look here for jpeg ...
http://www.vbaccelerator.com/home/VB/Code/vbMedia/Saving_Pictures_to_JPG/Using_Intel_JPG_Library/article.asp
http://www.vbaccelerator.com/home/VB/Code/vbMedia/Saving_Pictures_to_JPG/Using_Intel_JPG_Library/article.asp
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
have a look to this code too!
http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=42376&lngWId=1
http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=42376&lngWId=1
Dear
Use GDI+ type library for converting Images from one format to other. Please download gdi+.tlb from http://www.xtremevbtalk.com
then write this code you can save image in all types.
Private Sub cmdSave_Click()
Dim dblPercentage As Double
Dim lIndex As Long
On Error GoTo errorhandler
Set bmpOut = New cBitmap
Set graphic = New cGraphics
If bmpIn.Handle <> 0 Then
cdl.CancelError = True
cdl.Flags = cdlOFNOverwritePrompt
cdl.ShowSave
If LenB(cdl.FileName) Then
' GDI+ bug, must delete old file first
If LenB(Dir$(cdl.FileName)) Then Kill cdl.FileName
dblPercentage = hsbResize.Value / 100
bmpOut.CreateFromScan0 bmpIn.Width * dblPercentage, bmpIn.Height * dblPercentage, 0, bmpIn.PixelFormat, 0
graphic.GetGraphicsContext bmpOut.Handle
lIndex = bmpIn.ExtensionExists("*.b mp")
If lIndex > -1 Then
graphic.SetInterpolationMo de InterpolationModeHighQuali tyBilinear
graphic.DrawImageRectI bmpIn.Handle, 0, 0, bmpIn.Width * dblPercentage, bmpIn.Height * dblPercentage
bmpOut.SaveToFile cdl.FileName, bmpIn.EncoderGuid(lIndex), 0
End If
End If
End If
errorhandler:
Set graphic = Nothing
Set bmpOut = Nothing
' err silently
End Sub
You can also use Kodak ImageEdit , Kodak Image Admin controls and save Image as you want.
feel free to contact more.
Use GDI+ type library for converting Images from one format to other. Please download gdi+.tlb from http://www.xtremevbtalk.com
then write this code you can save image in all types.
Private Sub cmdSave_Click()
Dim dblPercentage As Double
Dim lIndex As Long
On Error GoTo errorhandler
Set bmpOut = New cBitmap
Set graphic = New cGraphics
If bmpIn.Handle <> 0 Then
cdl.CancelError = True
cdl.Flags = cdlOFNOverwritePrompt
cdl.ShowSave
If LenB(cdl.FileName) Then
' GDI+ bug, must delete old file first
If LenB(Dir$(cdl.FileName)) Then Kill cdl.FileName
dblPercentage = hsbResize.Value / 100
bmpOut.CreateFromScan0 bmpIn.Width * dblPercentage, bmpIn.Height * dblPercentage, 0, bmpIn.PixelFormat, 0
graphic.GetGraphicsContext
lIndex = bmpIn.ExtensionExists("*.b
If lIndex > -1 Then
graphic.SetInterpolationMo
graphic.DrawImageRectI bmpIn.Handle, 0, 0, bmpIn.Width * dblPercentage, bmpIn.Height * dblPercentage
bmpOut.SaveToFile cdl.FileName, bmpIn.EncoderGuid(lIndex),
End If
End If
End If
errorhandler:
Set graphic = Nothing
Set bmpOut = Nothing
' err silently
End Sub
You can also use Kodak ImageEdit , Kodak Image Admin controls and save Image as you want.
feel free to contact more.
Dear Sorry
You can also download code from this
http://www.xtremevbtalk.com/showthread.php?t=77960
Thanks
Osman Ishaque
You can also download code from this
http://www.xtremevbtalk.com/showthread.php?t=77960
Thanks
Osman Ishaque
You don't get this in win2000
Add Kodak image edit control (Project >> components >> kodak image edit ) to yur form.
load the image file into the edit control
imgedit1.image="filewithpa
imgedit1.display
Save the image in the format you need
imgedit1.savepage ............
There are options in savepage method.
Go thru them for each file format, filetype, and compression type.
On the form, Click on the imgedit control.
Press F1 to get full help...