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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Estimate TIF file size for a given compression

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
w2m Posted - Mar 15 2014 : 08:09:26
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
5   L A T E S T    R E P L I E S    (Newest First)
w2m Posted - Mar 15 2014 : 11:54:00
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
w2m Posted - Mar 15 2014 : 10:32:35
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
Uwe Posted - Mar 15 2014 : 10:02:40
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
w2m Posted - Mar 15 2014 : 09:23:12
Uwe...

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

William Miller
Uwe Posted - Mar 15 2014 : 08:46:35
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