Finding the pixel size of a picture

J

John

Hi,

How do I find the width and height of a picture stored on my harddrive
(eg a JPEG) in pixels within Word VBA? I have Word 97.

Thanks...
 
W

Word Heretic

G'day "John" <[email protected]>,

You would have to insert it into an invis, temp document and read its
properties from there. Otherwise you would have to find a system
function that read the file header for you, or build such logic in
yourself from the file specifications.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


John reckoned:
 
J

John

"You would have to insert it into an invis, temp document and read its
properties from there. Otherwise you would have to find a system
function that read the file header for you, or build such logic in
yourself from the file specifications."

Thanks, I thought I might have to temporarily insert it into the
document, even though I don't actually want to do this.

It looks like the easiest option s for me to read the picture into a
document temporaily. Do you have an example of how to read the
properties of the picture? I'm not interested in the size of the
picture in points after it is read into the document, but want to find
the size of the picture in pixels of the native file.
 
W

Word Heretic

G'day "John" <[email protected]>,

That would be the absolute pixel size / scale.


Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


John reckoned:
 
J

Jonathan West

John said:
Hi,

How do I find the width and height of a picture stored on my harddrive
(eg a JPEG) in pixels within Word VBA? I have Word 97.

Thanks...

take a look at the code at the following location

http://www.freevbcode.com/ShowCode.Asp?ID=112

It is a class module that you can use from a VBA project just as easily as
from a VB6 project.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top