Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, May 23, 2008 12:59:44 AM(UTC)

riggson  
riggson

Groups: Registered
Posts: 11


Hi,

I want to read the file size of each image from a multipage tiff. The example code that I've found on the forum seems not to be for the Image Suite v15.

++++ ++++
LEAD1.GetFileInfo "FileName.TIF", 0, FILEINFO_TOTALPAGES
For i = 1 To LEAD1.InfoTotalPages
LEAD1.GetFileInfo fname, i, FILEINFO_TOTALPAGES
MsgBox "size of file" + Str(LEAD1.InfoSizeMem)
Next i
++++ ++++

How can I do this with the Image Suite v15?
:^)
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Sunday, May 25, 2008 5:50:27 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)

Can you tell me what LEADTOOLS programming interface (DLL API, C++ Class Library, .NET classes or COM Interop) you want to use and what programming language you are using?
 
#3 Posted : Sunday, May 25, 2008 8:55:32 PM(UTC)

riggson  
riggson

Groups: Registered
Posts: 11


Hello again...

I am programming with Visual Basic .Net
 
#4 Posted : Monday, May 26, 2008 5:01:43 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)

Leadtools.Codecs.RasterCodecs.Startup()
Dim codecs As Leadtools.Codecs.RasterCodecs = New Leadtools.Codecs.RasterCodecs()
Dim img As Leadtools.RasterImage = codecs.Load("c:\test.tif")
Dim codecsinfo As Leadtools.Codecs.CodecsImageInfo
Dim i As Integer
For i = 0 To img.PageCount - 1
  codecsinfo = codecs.GetInformation("c:\test.tif", True, i)
  MsgBox(codecsinfo.SizeMemory)
Next
 
#5 Posted : Tuesday, May 27, 2008 1:24:18 AM(UTC)

riggson  
riggson

Groups: Registered
Posts: 11


Thank you for your reply.

The codecs.SizeMemory property returns the uncompressed size of the image. But I need the compressed size from each page of a CCITT4-compressed Tiff to filter pages with a size of less than 2K (compressed). How can I do this with Leadtools?

Riggson
 
#6 Posted : Tuesday, May 27, 2008 5:12:51 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)

Riggson,
You are
right. The memory size info is for uncompressed image size. The disk size info is for the entire TIFF file, not a specific page.

However,
there is a way to extract a page from a TIFF file without de-compressing and
re-compressing it. This means the currently-compressed image data is kept as
is, and you can test for disk size of the new TIFF file that holds this separate page. To do that, use the CompactFile Method.

 
#7 Posted : Tuesday, May 27, 2008 11:48:08 PM(UTC)

riggson  
riggson

Groups: Registered
Posts: 11


Hi Adnan,

I think the CompactFile method is not what I am searching for. But I found another interesting example in this forum which helps me to find a solution. Here is the code I create:

        Leadtools.Codecs.RasterCodecs.Startup()

        Dim codecs As Leadtools.Codecs.RasterCodecs = New Leadtools.Codecs.RasterCodecs()
        Dim ms As System.IO.MemoryStream
        Dim p As Integer
        Dim pageMax As Integer = MyMultiTiff.PageCount

        For p = 1 To pageMax
            ms = New System.IO.MemoryStream
            codecs.Save(MyMultiTiff, ms, 0, RasterImageFormat.CcittGroup4, 1,  p,  p,  p, Leadtools.Codecs.CodecsSavePageMode.Overwrite)
            Debug.writeln(ms.length) ' The compressed size of the image
        Next

Riggson
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.061 seconds.