insert pictures by automation?

  • Thread starter Thread starter ljb
  • Start date Start date
L

ljb

I need to insert various size jpg photos into PowerPoint by automation. Some
images are portrait and others are landscape and in varying sizes. Each
slide needs about 1" space at the bottom for a photo caption coming from
Access. I want the photos centered in the area above the caption and scaled
as large as will fit without changing the aspect ratio. I can read the image
length and width in pixels from the jpg file but how do I insert them into
the specific area? I'm currently using .addpicture to insert them.

thanks
LJB
 
ljb said:
I need to insert various size jpg photos into PowerPoint by automation. Some
images are portrait and others are landscape and in varying sizes. Each
slide needs about 1" space at the bottom for a photo caption coming from
Access. I want the photos centered in the area above the caption and scaled
as large as will fit without changing the aspect ratio. I can read the image
length and width in pixels from the jpg file but how do I insert them into
the specific area? I'm currently using .addpicture to insert them.

thanks
LJB
I have solved the problem.
1. convert the image width and height dimension from pixels to points. 1px =
0.75pt
2. read PowerPoint's page setup width and height in points
3. subtract 72 points (1") from page width to allow for caption area
4. discover image orientation by examining image width and height
5. scale the appropriate image dimension to match the appropriate page area
6. apply the same scale factor to the other image dimension
7. if the image is to be inserted portrait calculate the inserts location by
(page width - image width)/2 = X
 
Back
Top