Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
  YaBB is sponsored by XIMinc!
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
Print
2nd page of multi-page TIFF image isn't accessible (Read 173 times)
bigjim
YaBB Newbies
*
Offline


I Love YaBB 2!
Posts: 1

2nd page of multi-page TIFF image isn't accessible
07/28/07 at 23:53:30
 
I use CxImage to open a 4-page TIFF image file, i can get 1st, 3rd and 4th page information, however i can not retrieve 2nd page data, it always returns 1st page information (image width/height), is it a bug of CxImage or i did something wrong? I downloaded CxImage 6 months ago.

The code snippet :

  FILE *inFile = fopen(file_name, "rb");
  if (inFile == NULL)
     return;

  CxImage *img = new CxImage();
  img->SetFrame(-1);
  img->Decode(inFile, 6);
 
  // return 4
  int NumFrames = img->GetNumFrames();
 
 // 1st page
 img->SetFrame(0);
 img->Decode(inFile, 6);
 int w = img->GetWidth();
 int h = img->GetHeight();

 // something is wrong here.
 // 2nd page, width/height are same as 1st page width/height, actually they are not
 img->SetFrame(1);
 img->Decode(inFile, 6);
 w = img->GetWidth();
 h = img->GetHeight();

 // 3rd page, everything is correct
 img->SetFrame(2);
 img->Decode(inFile, 6);
 w = img->GetWidth();
 h = img->GetHeight();

 // 4rd page, everything is correct
 img->SetFrame(3);
 img->Decode(inFile, 6);
 w = img->GetWidth();
 h = img->GetHeight();

 
Back to top
 
 
IP Logged
 
Davide
YaBB Moderator
*****
Offline



Posts: 589

Re: 2nd page of multi-page TIFF image isn't access
Reply #1 - 07/29/07 at 19:59:34
 
try with a "fseek(inFile,0,SEEK_SET);" before each "img->Decode(inFile, 6);"
Back to top
 
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Print