Page 1 of 3
How to display TIF picture ?
Posted: Thu Nov 19, 2009 6:51 pm
by Ricci
The image-control of HMG only can display JPG, GIF and BMP images. Right?
So i use an activex control which uses the "Fax- and Pictureviewer" in Windows XP. That´s the relevant part of the code:
@ 005,550 ACTIVEX ImagePhoto WIDTH 320 HEIGHT 360 PROGID "Preview.Preview.1"
....
Form_1.ImagePhoto.Object:Showfile( "test.tif", 1 )
This works great, but only in Windows XP. Vista and Win7 has the new Photoviewer. I found the progid: "Microsoft.Photos.ViewerGalleryInterface.1", but what is the procedure i have to call for loading the image? No information to find about.
Any other solution ?
Thanks ... Ricci
Re: How to display TIF picture ?
Posted: Sat Nov 21, 2009 10:39 am
by Ricci
Re: How to display TIF picture ?
Posted: Sat Nov 21, 2009 11:47 am
by Roberto Lopez
There is a free dll called 'freeimage', perhaps it could help you to display a tiff.
Re: How to display TIF picture ?
Posted: Sat Nov 21, 2009 2:24 pm
by Ricci
Roberto Lopez wrote:There is a free dll called 'freeimage', perhaps it could help you to display a tiff.
Thanks for your help but I think it will not work with HMG or I don´t have the knowledge how to do that..
To use it you need to build your own class, build the lib/dll from C-source and much more. To difficult for me.
Re: How to display TIF picture ?
Posted: Sat Nov 21, 2009 3:00 pm
by gfilatov
Ricci wrote:Roberto Lopez wrote:There is a free dll called 'freeimage', perhaps it could help you to display a tiff.
Thanks for your help but I think it will not work with HMG or I don´t have the knowledge how to do that..
To use it you need to build your own class, build the lib/dll from C-source and much more. To difficult for me.
Hello Ricci,
We have the Harbour contrib library in the file
libhbfimage.a at folder hmg\harbour\lib with C-wrappers functions for using FreeImage.DLL.
Example of code:
Code: Select all
? "Initialise"
fi_Initialise()
//---------------------------//
? "Version :", fi_GetVersion()
? "Copyright :", fi_GetCopyrightMessage()
? "File type :", fi_GetFileType( IMAGES_IN + "sample1.jpg" )
? "Load JPEG directly from file"
im := fi_Load( FIF_JPEG, IMAGES_IN + "sample1.jpg", JPEG_DEFAULT )
? "Clone image"
clone := fi_Clone( im )
? "Pointer :", ValToPrg( im )
? "Image Type :", fi_GetImageType( im )
? "Color Used :", fi_GetColorsUsed( im )
? "Pixel size :", fi_GetBPP( im )
? "Width :", fi_GetWidth( im )
? "Height :", fi_GetHeight( im )
? "Byte Size :", fi_GetLine( im )
? "Pitch :", fi_GetPitch( im )
? "DIB Size :", fi_GetDIBSize( im )
? "Dots per Meter X :", fi_GetDotsPerMeterX( im )
? "Dots per Meter Y :", fi_GetDotsPerMeterY( im )
? "Color Type :", fi_GetColorType( im )
? "Red Mask :", fi_GetRedMask( im )
? "Green Mask :", fi_GetGreenMask( im )
? "Blue Mask :", fi_GetBlueMask( im )
? "Transp. Count :", fi_GetTransparencyCount( im )
? "Is Transparent ? :", fi_IsTransparent( im )
?
? "Save BMP ? :", fi_Save( FIF_BMP , im, IMAGES_OUT + "sample1.bmp", BMP_DEFAULT )
? "Save JPG ? :", fi_Save( FIF_JPEG, im, IMAGES_OUT + "sample1.jpg", JPEG_DEFAULT )
? "Save PNG ? :", fi_Save( FIF_PNG , im, IMAGES_OUT + "sample1.png", PNG_DEFAULT )
? "Save TIFF ? :", fi_Save( FIF_TIFF, clone, IMAGES_OUT + "sample1.tif", TIFF_DEFAULT )
? "Flip Horizontal ?:", fi_FlipHorizontal( clone )
? "Save JPG ? :", fi_Save( FIF_JPEG, clone, IMAGES_OUT + "horizont.jpg", JPEG_DEFAULT )
? "Flip Vertical ? :", fi_FlipVertical( clone )
? "Save JPG ? :", fi_Save( FIF_JPEG, clone, IMAGES_OUT + "vertical.jpg", JPEG_DEFAULT )
? "Rotate Classic :", ValToPrg( rotated := fi_RotateClassic( clone, 90 ) )
? "Save JPG ? :", fi_Save( FIF_JPEG, rotated, IMAGES_OUT + "rotate.jpg", JPEG_DEFAULT )
fi_Unload( rotated )
I hope that give you the ideas

Re: How to display TIF picture ?
Posted: Sat Nov 21, 2009 3:10 pm
by Ricci
gfilatov wrote:
Hello Ricci,
We have the Harbour contrib library in the file
libhbfimage.a at folder hmg\harbour\lib with C-wrappers functions for using FreeImage.DLL.
Example of code: ...
I hope that give you the ideas

Hmm ... looks like i´m a little bit foolish ... how do i use it?
I only learned Clipper/HMG, so a very short sample how to display a TIF in a HMG-Windows would be very very helpful.
Thanks ... Ricci
Re: How to display TIF picture ?
Posted: Sat Nov 21, 2009 3:49 pm
by gfilatov
Ricci wrote:gfilatov wrote:
Hello Ricci,
We have the Harbour contrib library in the file
libhbfimage.a at folder hmg\harbour\lib with C-wrappers functions for using FreeImage.DLL.
Example of code: ...
I hope that give you the ideas

Hmm ... looks like i´m a little bit foolish ... how do i use it?
I only learned Clipper/HMG, so a very short sample how to display a TIF in a HMG-Windows would be very very helpful.
Ricci,
No problem
Take a look for attached sample with all sources and compiled application.

Re: How to display TIF picture ?
Posted: Sat Nov 21, 2009 4:23 pm
by Ricci
gfilatov wrote:
No problem
Take a look for attached sample with all sources and compiled application.

I must be blind but i can´t compile your sample.
I´m using the last build of HMG and if i start with "build freeimage" i get a long errorlog, starting with:
Harbour 2.0.0beta3 (Rev. 12765)
Copyright (c) 1999-2009,
http://www.harbour-project.org/
freeview.o:freeview.c:(.data+0x88): undefined reference to `HB_FUN_MSGALERT'
freeview.o:freeview.c:(.data+0x198): undefined reference to `HB_FUN_INVALIDATERECT'
D:/hmg/harbour/lib/libhbfimage.a(fi_wrp.o):fi_wrp.c:(.text+0x17f): undefined reference to `_imp__FreeImage_Paste@20'
D:/hmg/harbour/lib/libhbfimage.a(fi_wrp.o):fi_wrp.c:(.text+0x31f): undefined reference to `_imp__FreeImage_Copy@20'
Re: How to display TIF picture ?
Posted: Sat Nov 21, 2009 5:16 pm
by gfilatov
Ricci wrote:gfilatov wrote:
No problem
Take a look for attached sample with all sources and compiled application.

I must be blind but i can´t compile your sample.
I´m using the last build of HMG and if i start with "build freeimage" i get a long errorlog, starting with:
Harbour 2.0.0beta3 (Rev. 12765)
Copyright (c) 1999-2009,
http://www.harbour-project.org/
freeview.o:freeview.c:(.data+0x88): undefined reference to `HB_FUN_MSGALERT'
freeview.o:freeview.c:(.data+0x198): undefined reference to `HB_FUN_INVALIDATERECT'
D:/hmg/harbour/lib/libhbfimage.a(fi_wrp.o):fi_wrp.c:(.text+0x17f): undefined reference to `_imp__FreeImage_Paste@20'
D:/hmg/harbour/lib/libhbfimage.a(fi_wrp.o):fi_wrp.c:(.text+0x31f): undefined reference to `_imp__FreeImage_Copy@20'
Please add to your project the following definition
#define MsgAlert( c ) MsgStop( c, "Attention" )
#define InvalidateRect( h , l ) RedrawWindow( h )
and also you'll need freeimage.lib was taken from freeimage.dll contribution.
I have a working demo application compiled by HMG Extended Edition which is included in archive.
Is it works for you

Re: How to display TIF picture ?
Posted: Sat Nov 21, 2009 5:38 pm
by Ricci
gfilatov wrote:[
and also you'll need freeimage.lib was taken from freeimage.dll contribution.
I have a working demo application compiled by HMG Extended Edition which is included in archive.
Is it works for you

Where do i have to put the Lib to? Because i get this error log (only the beginning and end
Harbour 2.0.0beta3 (Rev. 12765)
Copyright (c) 1999-2009,
http://www.harbour-project.org/
D:/hmg/harbour/lib/libhbfimage.a(fi_wrp.o):fi_wrp.c:(.text+0x17f): undefined reference to `_imp__FreeImage_Paste@20'
D:/hmg/harbour/lib/libhbfimage.a(fi_wrp.o):fi_wrp.c:(.text+0x31f): undefined reference to `_imp__FreeImage_Copy@20'
...
D:/hmg/harbour/lib/libhbfimage.a(fi_winfu.o):fi_winfu.c:(.text+0x4c2): undefined reference to `_imp__FreeImage_GetBits@4'
D:/hmg/harbour/lib/libhbfimage.a(fi_winfu.o):fi_winfu.c:(.text+0x4d0): undefined reference to `_imp__FreeImage_GetInfoHeader@4'
collect2: ld returned 1 exit status
hbmk2: Error: Running linker. 1
gcc.exe test.o hbmk_j37rn7.o D:/hmg//resources/minigui.o -mwindows -Wl,--start-group -lminigui -lhbmysql -lmysql -lcrypt -ledit -leditex -lgraph -lini -lreport -lhbwin -lhbziparc -lhbmzip -lmsvfw32 -lvfw32 -lsddodbc -lrddsql -lsddmy -lhbodbc -lodbc32 -lhbhpdf -lhbvpdf -lhbmemio -lhbsqlit3 -lsqlite3 -lhbfimage -lhbpgsql -lpq -lhbtip -lhbct -lhbmisc -lhbnetio -lxhb -lhbextern -lhbdebug -lhbvm -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtwin -lgtwvt -lgtgui -lhbrdd -lhbuddall -lhbusrrdd -lrddntx -lrddcdx -lrddnsx -lrddfpt -lhbrdd -lhbhsx -lhbsix -lhbmacro -lhbcplr -lhbpp -lhbcommon -lkernel32 -luser32 -lgdi32 -ladvapi32 -lws2_32 -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lwinmm -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlib -Wl,--end-group -otest.exe -LD:/hmg/harbour/lib -LD:/hmg//lib