By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,475 Members | 2,093 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,475 IT Pros & Developers. It's quick & easy.

Dimensions of gif & jpeg files

P: n/a

I need to be able to obtain the dimensions of some graphics files. Most of
what I have found in this group seems to indicate loading the files into a
form, then obtaining the dimensions form a picture object. I have over 17K
files that I would like to get the dimensions for, and this seems like it
would be a bit time consuming. I found the following code. could this be
modified and used in a form? I am using Access98.

(from http://lists.evolt.org/archive/Week-...10/115239.html)
'--code begin
Dim header As String
Dim f As Integer
filename="c:\top_e.gif"
Open filename For Input As #f
If Lcase(Right(filename, 3))="gif" Then
header = Input(10, f)
Close #f
wHi = Mid(header, 8, 1)
wLo = Mid(header, 7, 1)
hHi = Mid(header, 10, 1)
hLo = Mid(header, 9, 1)
w = Asc(wHi) * 256 + Asc(wLo)
h = Asc(hHi) * 256 + Asc(hLo)
Elseif Lcase(Right(filename, 3))="jpg" Then
header = Input(167, f)
Close #f
wHi = Asc(Midbp(header, 166, 1))
wLo = Asc(Midbp(header, 167, 1))
hHi = Asc(Midbp(header, 164, 1))
hLo = Asc(Midbp(header, 165, 1))
w = (wHi) * 256 + (wLo)
h = (hHi) * 256 + (hLo)
End If
'--code end
--
Daron S. Lowell
indigo +
flmtgif.org
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.556 / Virus Database: 348 - Release Date: 12/26/03
Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.