How to display TIF picture ?
Moderator: Rathinagiri
How to display TIF picture ?
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
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 ?
So many views but no idea how to solve this problem?
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: How to display TIF picture ?
There is a free dll called 'freeimage', perhaps it could help you to display a tiff.Ricci wrote:So many views but no idea how to solve this problem?
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
Re: How to display TIF picture ?
Thanks for your help but I think it will not work with HMG or I don´t have the knowledge how to do that..Roberto Lopez wrote:There is a free dll called 'freeimage', perhaps it could help you to display a tiff.
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 ?
Hello Ricci,Ricci wrote:Thanks for your help but I think it will not work with HMG or I don´t have the knowledge how to do that..Roberto Lopez wrote:There is a free dll called 'freeimage', perhaps it could help you to display a tiff.
To use it you need to build your own class, build the lib/dll from C-source and much more. To difficult for me.
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 )
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Re: How to display TIF picture ?
Hmm ... looks like i´m a little bit foolish ... how do i use it?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
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 ?
Ricci,Ricci wrote:Hmm ... looks like i´m a little bit foolish ... how do i use it?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
I only learned Clipper/HMG, so a very short sample how to display a TIF in a HMG-Windows would be very very helpful.
No problem
Take a look for attached sample with all sources and compiled application.
- Attachments
-
- FreeView.ZIP
- Demo application
- (1.56 MiB) Downloaded 483 times
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Re: How to display TIF picture ?
I must be blind but i can´t compile your sample.gfilatov wrote: No problem
Take a look for attached sample with all sources and compiled application.
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 ?
Please add to your project the following definitionRicci wrote:I must be blind but i can´t compile your sample.gfilatov wrote: No problem
Take a look for attached sample with all sources and compiled application.
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'
#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
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Re: How to display TIF picture ?
Where do i have to put the Lib to? Because i get this error log (only the beginning and endgfilatov 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
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