BMP to GIF Converter
Posted: Thu May 08, 2008 7:31 pm
I'm looking for a small executable or DLL library I can use to convert BMP format images to GIF.. Anyone know of anything?
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
IncludeFile "RW_FreeImage_Inc.pb"
dib = FreeImage_Load(#FIF_BMP, "bm1.bmp", #BMP_DEFAULT)
FreeImage_Save(#FIF_GIF, dib, "test.gif",0)
You can indeed, I just tried it.Derek wrote:I'm pretty sure you can save GIF's using GDI+.
Code: Select all
#GDIPLUS_OK = 0
;-Structures.
Structure GdiplusStartupInput
GdiPlusVersion.l
*DebugEventCallback.DebugEventProc
SuppressBackgroundThread.l
SuppressExternalCodecs.l
EndStructure
;-Imports.
Import "gdiplus.lib"
GdiplusStartup(token, *input.GdiplusStartupInput, output)
GdiplusShutdown(token)
GdipCreateBitmapFromFile(filename.p-unicode, *bitmap)
GdipSaveImageToFile(image, filename.p-unicode, *clsidEncoder.CLSID, *encoderParams)
GdipDisposeImage(image)
EndImport
;First initialise gdi+.
input.GdiplusStartupInput
input\GdiPlusVersion = 1
GdiplusStartup(@token, @input, #Null)
;Was the initialisation successful?
If token
If GdipCreateBitmapFromFile("bm1.bmp", @image) = #GDIPLUS_OK
GdipSaveImageToFile(image, "test.gif", ?clsid_giff, 0)
GdipDisposeImage(image)
EndIf
;Tidy up.
GdiplusShutdown(token)
EndIf
End
;CLSID for the gdi+ gif encoder.
DataSection
clsid_giff:
Data.l $557CF402
Data.w $1A04, $11D3
Data.b $9A, $73, $00, $00, $F8, $1E, $F3, $2E
EndDataSection
Oh, and FreeImage_IsPluginEnabled(#FIF_GIF) does return 1Karbon wrote:Thanks!
I can't get FreeImage to create a gif.. I can change FIF_GIF to FIF_JPEG (or any other format) and it works great. If I use GIF it just creates a 4k blank file.
I'm using Progi's wrapper and it looks to be up to date..