Adjusting a picture size dynamically


Is there a way to add pictures to a slide, but adjust the picture size dynamically, depending on the picture you wish to add to the slide? For example, if jpg or gif images are stored in SQL Server, I may wish to adjust the size, based on the image. Do I create a picture frame or place holder? If this can be done, can you give a brief code example?


The size I am referring to is in the power point template. So maybe one image is 1 inch square and another should be 2 inches square. I’m not sure if I am giving the details of what I like to do properly. Please let me know.


Dear Randy,

You can adjust picture size by PictureFrame.Width and PictureFrame.Height properties and move it by changing PictureFrame.X and PictureFrame.Y.

1 inch on slide is 576 internal points.


I have a question on the 576 internal points. Is that the same as Pixels? I think pixels are the resolution of the image. So if we have an application where the user uploads a jpeg or gif image (the images could be different sizes) to a SQl Server database as a blob field, from an application (I need to display this in a power point picture frame) should I work with pixels? Can I determine the original size of the uploaded image in inches, for example? I am trying to think though this issue and maybe you have some thoughts on this. Maybe I am confusing the original image size (pixels or inches) and the output on the power point slide (pixels or inches).


So let me put the question another way. When our users upload a phone image, the results are stored in an SQL Server blob field. I understand you can get the height and width in pixels, if the stream object is converted to a drawing image. Now a pixel is defined as:
1. Pixel (combination of Picture & Element) is the smallest element of a display which can be assigned a color. If your display is set to the maximum resolution, it is the smallest building block on the monitor. If your display is set to a lower resolution, it can be made up of several blocks to form each pixel.
2. An abbreviation of the term ‘picture element.’ A pixel is the smallest picture element of a digital image. Like the fibers of a fabric, individual pixels are too small to notice, but together they make up the whole.
When the images are displayed in our screen application, and I was to measure the images in inches, most would be one inch square, but a few odd ones would be 2 inches square. Now if I were to upload these images in the power point template, everything is OK for the one inch square images, but NOT OK for the 2 inch square images (as I see on the ASP.NET screen). But since I can only determine an application file in pixel width and height (as far as I can tell), I don’t know how to determine which images to stretch to 2 inches. Unless the power point picture frames are also given in pixels.


Dear Randy,

PictureFrame and Image are given in pixels but with different resolution.
Resolution of PictureFrame is 576 ppi and resolution of screen is 96 ppi.
So, if I’m not mistaken, you should have image 96x96 pixels to show it without
distortion on screen with PictureFrame size 576x576 pixels (1x1 inches).


Thanks for the information and difference between Power Point and screen Pixel resolution.