FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour MakeThumbNail en FreeImage
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
MakeThumbNail en FreeImage
Posted: Thu Dec 19, 2013 02:54 AM
Podria alguien implementar hacer un thumbnail con freeimage, lo he intentado pero no se como guardar el archivo destinol

static FIBITMAP MakeThumbnail(
FIBITMAP dib,
int max_pixel_size,
bool convert
)


dib
Type: FreeImageAPI.FIBITMAP
Handle to a FreeImage bitmap.
max_pixel_size
Type: System.Int32
Thumbnail square size.
convert
Type: System.Boolean
When true HDR images are transperantly converted to standard images.

Code (fw): Select all Collapse
DLL32 FUNCTION FMAKETHUMBNAIL( hDib AS LONG, nMaxPixelSize AS INTEGER, lConvert AS BOOL ) AS LONG ;
      PASCAL FROM If( IsExe64(), "FreeImage_MakeThumbnail", "_FreeImage_MakeThumbnail@12" ) LIB hLib

Code (fw): Select all Collapse
function FIMakeThumbNail( cSrcFile, cDstFile, nSize )

   local nSrcFormat, hDib, hDib2, lOk := .f.

   DEFAULT nQuality := 0

   if LoadFreeImage() > 32

      nSrcFormat = FIGETFILETYPE( cSrcFile, 0 )

      hDib = FILOAD( nSrcFormat, cSrcFile, 0 )
      hDib2 = FIMAKETHUMBNAIL( hDib, nSize, FALSE )
      
      //
      //lOk = FISAVE( nDstFormat, hDib2, cDstFile, nQuality )
      //

      FIUNLOAD( hDib )
      FIUNLOAD( hDib2 )

   endif

return lOk
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: MakeThumbNail en FreeImage
Posted: Thu Dec 19, 2013 11:26 AM

Carlos,

Una vez hayas obtenido el hDib del Thumbnail, lo puedes salvar a disco asi:

DibWrite( cNombreFichero, hDib )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: MakeThumbNail en FreeImage
Posted: Thu Dec 19, 2013 02:43 PM

Gracias, Antonio, modifico, pruebo y comento.
salu2

Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: MakeThumbNail en FreeImage
Posted: Thu Dec 19, 2013 03:49 PM
Bueno, ya ha quedado:
seria interesante como un methodo de la clase timage y tbitmap, asi como que creara el thumbnail de un resource, o que lo creara a memoria.

Antonio, lo podrias agregar de serie a fwh?

como usar
Code (fw): Select all Collapse
...
   FIMakeThumbNail( ".\resource\bitmaps\bm_menu.bmp", ".\pequeno.bmp", 32 )
   FIMakeThumbNail( ".\resource\bitmaps\pan_setting.png", ".\pan_setting.png", 32 )
...


agregar a image.prg
Code (fw): Select all Collapse
DLL32 FUNCTION FMAKETHUMBNAIL( hDib AS LONG, nPixel AS LONG, lConvert AS BOOL ) AS LONG ;
      PASCAL FROM If( IsExe64(), "FreeImage_MakeThumbnail", "_FreeImage_MakeThumbnail@12" ) LIB hLib

Code (fw): Select all Collapse
function FIMakeThumbNail( cSrcFile, cDstFile, nPixel )
   local nSrcFormat, hDib, hDib2, lOk := .F.

   if LoadFreeImage() > 32

      nSrcFormat := FIGETFILETYPE( cSrcFile, 0 )
      hDib       := FILOAD( nSrcFormat, cSrcFile, 0 )
      hDib2      := FMAKETHUMBNAIL( hDib, nPixel, .T. )

      lOk = FISAVE( nSrcFormat, hDib2, cDstFile, 0 )

      FIUNLOAD( hDib  )
      FIUNLOAD( hDib2 )

   endif

return lOk
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: MakeThumbNail en FreeImage
Posted: Thu Dec 19, 2013 07:37 PM

Carlos,

Añadido. muchas gracias :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: MakeThumbNail en FreeImage
Posted: Tue Feb 25, 2014 07:57 AM

can see a simply test sample ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 162
Joined: Tue Feb 03, 2009 10:08 PM
Re: MakeThumbNail en FreeImage
Posted: Sun Mar 02, 2014 09:52 PM

Amigos, a partir de que versión de fivewin se puede implementar las miniaturas con thumbnail.

Gracias

J. Ernesto Pinto Q.
Fwh_x64 2501, BCC++_x64 7_70 , Harbour 3.20, LopeEdit 5.8
jepsys@hotmail.com, jepsys@gmail.com

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: MakeThumbNail en FreeImage
Posted: Wed Mar 05, 2014 08:24 AM
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces

Continue the discussion