Page 1 of 1

It work now. *Conversion problem BMP to JPG*

Posted: Mon Sep 03, 2007 7:49 am
by dutch
Dear All,

I try to convert from BMP to JPG with FreeImage.dll. It's used to work with 16bits but I don't work with 32bits. I don't know while.

Thanks for any help,
Dutch


Code: Select all

       
FUNCTION SaveImage( cFile )
LOCAL nFormat, hDib, hInfoH, hInfo, hBits, hWnd, hDC, hBmp, lOk

#ifdef __CLIPPER__ 
    hLib = LOADLIB32( "freeimage.dll" ) 
#else 
    hLib = LOADLIBRARY( "freeimage.dll" ) 
#endif 

    if hLib <= 32 
        MsgStop( "Cannot load FreeImage.dll" ) 
        return 0 
    endif 

    nFormat := FIGETFILETYPE( cFile, 0 )
    hDib    := FILOAD( nFormat, cFile, 0 )
    hInfoH  := FIGETINFOHEADER( hDib )
    hInfo   := FIGETINFO( hDib )
    hBits   := FIGETBITS( hDib )
    hWnd    := GETDESKTOPWINDOW()

#ifdef __CLIPPER__ 
    hDC = GETDC32( hWnd ) 
#else 
    hDC = GETDC( hWnd ) 
#endif 

lOk := fiSave( 2 , hDib, cFile )

hBmp = CREATEDIBITMAP( hDC, hInfoH, CBM_INIT, hBits, hInfo, DIB_RGB_COLORS ) 

#ifdef __CLIPPER__ 
    RELEASEDC32( hWnd, hDC ) 
#else 
    RELEASEDC( hWnd, hDC ) 
#endif 

FIUNLOAD( hDib ) 

#ifdef __CLIPPER__ 
    FREELIB32( hLib ) 
#else 
    FREELIBRARY( hLib ) 
#endif 
RETURN hBmp
I for got this line .
lOk := fiSave( 2 , hDib, cFile )


It work now.

Thanks,
Dutch