all groups > dotnet drawing api > december 2005 >
You're in the

dotnet drawing api

group:

Number of pages in tiff file...


Number of pages in tiff file... zamdrist NO[at]SPAM gmail.com
12/29/2005 3:46:43 PM
dotnet drawing api:
Trying to determine the number of pages in a tiff file. I'm assuming
System.Drawing calls pages frames.

Here's what I have now, although it clearly doesn't work:

Dim img As Image
Dim dimen As Guid()

img = Image.FromFile("C:\eofb_396.tif")
dimen = img.FrameDimensionsList

MsgBox(dimen.GetUpperBound(0))


Ideas? Thoughts? I'm digging into the System.Drawing & Imaging
constructs.

Thanks!
RE: Number of pages in tiff file... Jeff at Bennet-Tec.com
12/29/2005 9:47:01 PM
Here is some sample code
This will get you the number of frames in the TIF image
as well as display them one by one in a picturebox

Dim FName As String
Dim pic As Image
Dim frameCount As Integer
Dim iFrame As Integer

' Get the complete TIF into an object
FName = "c:\somepath\somefile.tif"
pic = Image.FromFile( FName )
' Count the frames
frameCount = pic.GetFrameCount( Imaging.FrameDimension.Page )
MsgBox("there are " & frameCount.ToString & " frames")
' Process one frame at a time - display and convert to GIF
For iFrame = 0 To frameCount - 1
' get current frame
pic.SelectActiveFrame( Imaging.FrameDimension.Page, iFrame )
PictureBox1.Image = New Bitmap( pic )
MsgBox("Showing Frame #" & iFrame.ToString )
Next

Does this meet your needs ?

* * Please include a copy of this message with your reply

Jeff Bennett
Jeff @ Bennet-Tec.Com

* Bennet-Tec Information Systems, Inc
* 50 Jericho Tpk, Jericho, NY 11753
* Phone 516 997 5596, Fax - 5597
* RELIABLE Components Make You Look Sharp!
* TList/Pro * ALLText HT/Pro * MetaDraw *
* Custom Software Development Services Too.
* WWW.Bennet-Tec.Com

=================== ===================

[quoted text, click to view]
Re: Number of pages in tiff file... zamdrist NO[at]SPAM gmail.com
12/30/2005 9:53:40 PM
That worked perfectly. Thank you!

[quoted text, click to view]
AddThis Social Bookmark Button