MakeThumbNail en FreeImage

Post Reply
User avatar
carlos vargas
Posts: 1721
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

MakeThumbNail en FreeImage

Post by carlos vargas »

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: Select all | Expand


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: Select all | Expand


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)
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 76 times
Contact:

Re: MakeThumbNail en FreeImage

Post by Antonio Linares »

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
User avatar
carlos vargas
Posts: 1721
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: MakeThumbNail en FreeImage

Post by carlos vargas »

Gracias, Antonio, modifico, pruebo y comento.
salu2
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
Posts: 1721
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: MakeThumbNail en FreeImage

Post by carlos vargas »

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: Select all | Expand


...
   FIMakeThumbNail( ".\resource\bitmaps\bm_menu.bmp", ".\pequeno.bmp", 32 )
   FIMakeThumbNail( ".\resource\bitmaps\pan_setting.png", ".\pan_setting.png", 32 )
...
 


agregar a image.prg

Code: Select all | Expand



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: Select all | Expand


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)
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 76 times
Contact:

Re: MakeThumbNail en FreeImage

Post by Antonio Linares »

Carlos,

Añadido. muchas gracias :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Silvio.Falconi
Posts: 7136
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

Re: MakeThumbNail en FreeImage

Post by Silvio.Falconi »

can see a simply test sample ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
J. Ernesto
Posts: 161
Joined: Tue Feb 03, 2009 10:08 pm
Location: Bogotá D.C. Colombia
Contact:

Re: MakeThumbNail en FreeImage

Post by J. Ernesto »

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

Gracias
J. Ernesto Pinto Q.
Fwh_x64 2407 + BCC++_x64 7_70__6_72 + Harbour 3.20 + LopeEdit 5.8 + UEstudio 26.0
jepsys@hotmail.com, jepsys@gmail.com, jepsys@yahoo.com
User avatar
cnavarro
Posts: 6557
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: MakeThumbNail en FreeImage

Post by cnavarro »

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
Post Reply