Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dimensions of a TIFF

Status
Not open for further replies.

mbro

Programmer
Nov 12, 2004
25
0
0
US
Hi,

I'm using VB within ESRI ArcGIS which is a little limited in its functionality. I need a way of obtaining the dimensions of a TIFF without loading it into a picture box. Perhaps read as raw data or through a control I'm not sure. I've found ways to do BMPs, JPEGs and GIFs as follows...

Dim myPicture As IPictureDisp
Set myPicture = LoadPicture(TextBox1 & TextBox11)

i_width = MulDiv(myPicture.Width, 1440, 2540) / 15
i_height = MulDiv(myPicture.Height, 1440, 2540) / 15

Set myPicture = Nothing

but this method does not work for TIFFS as it says it's an invalid picture type. Can someone help me out?

Thanks,
Mike
 
Check out thread184-1268702 - File properties
It's VFP but actually it calls Shell application, and the link to Microsoft site shows some Basic code. (?)
I tried it with VB6; got strange thing - it works in
For Each strFileName in objFolder.Items
next
loop (as in MS example),
but if I do instead
strFileName = objFolder.ParseName("123.tif")
I keep getting attribute names twice (instead of attr name: value) .
Strange thing that it works OK in VFP...
 
Found why it wasn't working in VB6: I miss one Set word.
So this one works (for particular file in app folder):
(in Button Click on a form)
Code:
Dim arrHeaders(35)
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(App.Path + "\")  'folder
For i = 0 To 34
 arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
Next

Set strFileName = objFolder.ParseName("123.tif")

For i = 0 To 34
 Me.Print i & vbTab & arrHeaders(i) _
 & ": " & objFolder.GetDetailsOf(strFileName, i)
Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top