Sizing an Image

  • Thread starter Thread starter Edward Harford
  • Start date Start date
E

Edward Harford

I want to test the orientation and sizing of a jpg file from disk and the
create Image in a Word Document using Word Document object:
docWord.Shapes.AddPicture filename etc.
How can I test Height and Width of that file?
With thanks in advance
EHarford
 
This is a copy of a reply to a post in microsoft.public.access.modulesdaovba
that I answered (subject: When reading through files in a dir - can I get
size of jpeg's?). Hopefully it may provide a possible solution for you:

***** BEGIN COPY ****

Ok, this is not an ideal solution, but it might work for you:

Dim f As String
f = "myPicture.jpg"

Dim im As Object

Form_Form2.Image1.Picture = f
MsgBox Form_Form2.Image1.ImageWidth / 15
MsgBox Form_Form2.Image1.ImageHeight / 15

I've embedded an invisible picture control on this form and I use it to load
the image. I then ask it to give me the details on the image. The "/ 15"
converts the number it returns into screen pixels.
Hope that might get you closer. Post back if you still have questions.
--
Bryan Reich
Microsoft Office
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


Jesper F said:
I know how to read through a directory and place the file
names in a table.
But is it possible to read through a directory with image
files (jpg) and obtain the size/dimensions in pixels of
each image?

Thanks for any help.

***** END COPY ****
 
Back
Top