Tiff files with Freeimage

Tiff files with Freeimage

Postby Andrés González » Thu Jul 07, 2011 4:22 pm

I'm trying to work with FreeImage multipage format (TIFF). I took the contributions of the example hbfimage harbour and have generated the libraries that integrates seamlessly into the program. As the theme of the images I am a relative novice, I want to know if anyone comes up with how. The following code adds, deletes and count the images (see /*--*/) , and everything it does perfectly. When I delete a picture off me and when I add it sum and the result is always correct:
Code: Select all  Expand view
function Main(  )
     Local oIcon, oBar, oPopup, oImg, oInspec, oImg2
     
   SET _3DLOOK ON
 
   DEFINE ICON  oIcon  FILE "Tif.ico"

   DEFINE WINDOW oWnd FROM 1, 1 TO 22, 75 ;
      TITLE "Editor TIFF V 1.0" MENU BuildMenu() ;
      ICON oIcon ;
      MDI
 
 
   fi_Initialise()
  hImg := FI_OPENMULTIBITMAP( FIF_TIFF, IMAGES_IN + "sample1.tif",.f.,.f.,.t., TIFF_DEFAULT ) //Read only and keep cache in memory
   /*
   ? "Page count       :" + str(fi_GetPageCount( hImg ))
   ? "Delete page 1 "
   fi_DeletePage( hImg, 1 )
   ? "Page count       :" + str(fi_GetPageCount( hImg ))
   hImg2 := fi_Load( FIF_JPEG, "sample1.jpg", JPEG_DEFAULT )
   ? "Añado una pagina más"
   fi_appendpage(hImg, hImg2)
   ? "Page count       :" + str(fi_GetPageCount( hImg ))
   */

   FOR nPage := 1 TO fi_GetPageCount( hImg )
                     //How I can show all the pictures of the multipage file.
            @ nPage , 1 IMAGE oImg FILE "Sample1.tiff" SIZE 200, 200 of oWnd ADJUST //Not work
    NEXT
   

   SET MESSAGE OF oWnd TO FWVERSION CLOCK DATE KEYBOARD NOINSET 2007

   ACTIVATE WINDOW ownd MAXIMIZED

RETURN NIL
 



But I don't know what it needs to be done for display in the window. I guess there's no display but I think that can be displayed one by one. Anyone know how.
Saludos

Andrés González desde Mallorca
User avatar
Andrés González
 
Posts: 628
Joined: Thu Jan 19, 2006 10:45 am
Location: Mallorca

Re: Tiff files with Freeimage

Postby rspilon » Wed Jul 13, 2011 1:13 am

Think of it this way - Windows only truly supports bitmaps natively (gdi object) - so - what you have to do is extract a page from the TIFF ( a TIFF file is simply a "container" with one or more images ), convert it to a bitmap and then display that bitmap.

I haven't used FreeImage - and have used the main LibTiff library in the past.
rspilon
 
Posts: 8
Joined: Sat Apr 28, 2007 5:58 am

Re: Tiff files with Freeimage

Postby rspilon » Wed Jul 13, 2011 1:52 am

http://www.paulbradley.org/28/

It's VB - but it should give you enough to go on.
rspilon
 
Posts: 8
Joined: Sat Apr 28, 2007 5:58 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 84 guests