ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Estimate TIF file size for a given compression
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

w2m

USA
1990 Posts

Posted - Mar 15 2014 :  08:09:26  Show Profile  Reply
Is there a way to estimate TIF file size for a given TIF_Compression without saving the file?
EDIT: The TIF File has multi-frames.

ImageEnMView1.MIO.Params[i].TIFF_ZIPCompression := 2; { Maximum }
ImageEnMView1.MIO.Params[i].TIFF_Compression := ioTIFF_G4FAX;

William Miller

Uwe

284 Posts

Posted - Mar 15 2014 :  08:46:35  Show Profile  Reply
Bill, I would write the image to a memory stream and check the size of the
stream. That's probably as good as it gets.

HTH
Uwe
Go to Top of Page

w2m

USA
1990 Posts

Posted - Mar 15 2014 :  09:23:12  Show Profile  Reply
Uwe...

See my edit... can you save multi-frames to a stream?

William Miller
Go to Top of Page

Uwe

284 Posts

Posted - Mar 15 2014 :  10:02:40  Show Profile  Reply
Bill

Never tried it, but I can't see any reason why that shouldn't be possible. Here's an ASP.NET solution for example:

http://stackoverflow.com/questions/1255024/stream-and-convert-multi-page-tiff-using-asp-net/1261533#1261533

If that doesn't work, then you should at least be able to split the multiframe TIF and create a memory stream for each frame.

-Uwe
Go to Top of Page

w2m

USA
1990 Posts

Posted - Mar 15 2014 :  10:32:35  Show Profile  Reply
I tried this, but the result is the same, regardless of the compression:

var
  iMemoryStream: TMemoryStream;
  iFileSize: Int64;
begin
   {Save all the frames to a stream }
   ImageEnMView1.MIO.SaveToStreamTIFF(iMemoryStream);
   iFileSize := iMemoryStream.Size;
   dxStatusBar1.Panels[7].Text := FormatByteSize(iFileSize); 
end;

So my guess is, it will not work.

Maybe I'll try saving the file to a temp folder...

William Miller
Go to Top of Page

w2m

USA
1990 Posts

Posted - Mar 15 2014 :  11:54:00  Show Profile  Reply
After some more testing I found that the size of the stream produces the same result as getting the filesize from a temporary file.

The problem I had was, that a call to updatestatusbar which updated the filesize on a statusbar overwrote the filesise with the filesize of the original file unprocessed tif file which is why the filesize did not change.

The code I posted earlier works just fine.

William Miller
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: