local cImage := "image.bmp"
local
local oGdi := GDIBmp():new( cImage )
oGdi:save( "imagenfinal.png")
oGdi:end()
REQUEST GDIBMP
FUNCTION LOADIMG( cFile )
IF !FILE( cFile )
RETURN 0
ENDIF
RETURN GDIP_IMAGEFROMFILE( cFile, .T. )
FUNCTION SAVEIMG( cSrcFile, cDstFile )
LOCAL aExt := { "BMP", "JPG", "GIF", "TIF", "PNG" }
LOCAL aIds := { "{557CF400-1A04-11D3-9A73-0000F81EF32E}",;
"{557CF401-1A04-11D3-9A73-0000F81EF32E}",;
"{557CF402-1A04-11D3-9A73-0000F81EF32E}",;
"{557CF405-1A04-11D3-9A73-0000F81EF32E}",;
"{557CF406-1A04-11D3-9A73-0000F81EF32E}",;
"{557CF403-1A04-11D3-9A73-0000F81EF32E}",;
"{557CF404-1A04-11D3-9A73-0000F81EF32E}",;
"{557CF407-1A04-11D3-9A73-0000F81EF32E}" }
LOCAL cExt := CFILEEXT( cDstFile )
LOCAL nExt := ASCAN( aExt, cExt )
LOCAL cId := aIds[ nExt ]
LOCAL hImg := GDIPLUSIMAGELOADCACHEDFILE( cSrcFile )
IF hImg = 0 THEN RETURN .F.
GDIPLUSIMAGESAVE( hImg, ANSITOWIDE( cDstFile ), ANSITOWIDE( cId ) )
DELETEOBJECT( hImg )
RETURN .T.
Enrico Maria Giordano wrote:These are a couple of functions I wrote:
[code=fw]
GDIPLUSIMAGESAVE( hImg, ANSITOWIDE( cDstFile ), ANSITOWIDE( cId ) )
EMG
LOCAL hImg := GDIPLUSIMAGELOADCACHEDFILE( cSrcFile )
IF hImg = 0 THEN RETURN .F.
GDIPLUSIMAGESAVE( hImg, ANSITOWIDE( cDstFile ), ANSITOWIDE( cId ) )
DELETEOBJECT( hImg )[/quote]
GDIP_DELETEIMAGE( hImg )
Enrico Maria Giordano wrote:[quote="Enrico Maria Giordano"
- Code: Select all Expand view
LOCAL hImg := GDIPLUSIMAGELOADCACHEDFILE( cSrcFile )
IF hImg = 0 THEN RETURN .F.
GDIPLUSIMAGESAVE( hImg, ANSITOWIDE( cDstFile ), ANSITOWIDE( cId ) )
DELETEOBJECT( hImg )[/quote]
Do I have to use
- Code: Select all Expand view
GDIP_DELETEIMAGE( hImg )
instead to release the image, right? Can you confirm this?
EMG
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL cSrcImage := "c:\fwh\bitmaps\magic.bmp"
LOCAL cDstImage := "magic.gif"
LOCAL oGdi := GDIBmp():New( cSrcImage )
oGdi:Save( cDstImage )
oGdi:End()
RETURN NIL
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 54 guests