It work now. *Conversion problem BMP to JPG*

It work now. *Conversion problem BMP to JPG*

Postby dutch » Mon Sep 03, 2007 7:49 am

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  Expand view  RUN
       
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
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 116 guests