i am trying add a picture to slide using this code
but the picture size get shrinked am i doing somthing wrong ?
* for now im using the aspse without a lisence just for testing ,is the picturs get
srinked for this resone ?
int picId = AddPicToPresentation(pres, picURL);
//Calculating picture width and height
double pictureWidth = pres.Pictures[picId - 1].Image.Width;
double pictureHeight = pres.Pictures[picId - 1].Image.Height;
//Calculating the width and height of picture frame
int pictureFrameWidth = Convert.ToInt32(slide.Background.Width / 2 - pictureWidth / 2);
int pictureFrameHeight = Convert.ToInt32(slide.Background.Height / 2 - pictureHeight / 2);
;//Adding picture frame to the slide
slide.Shapes.AddPictureFrame(picId, pictureFrameWidth, pictureFrameHeight,
Convert.ToInt32(pictureWidth), Convert.ToInt32( pictureHeight));
}
Dear Amit,
Thanks for considering Aspose.Slides.
The picture size on slide depends on the dimensions of PictureFrame, for example if your picture is 800x640 but the PictureFrame is 200x200, then the picture will be adjusted/shrinked to 200x200 which is the dimensions of PictureFrame. Similarly, if your picture is 200x200 but the PictureFrame is 800x640, then your picture will be automatically adjusted/enlarged to dimensions of PictureFrame.
But im setting the pictureframe to the same size of the picture
lets say my picture size is 976X2158 (quite a big picture common screen resolution 1280X1024)
the slide backgroud size is 5760X4230
as i see it the pic width is one forth of the slide
and the widht is aboth half so it's no surprise the pictrue will look small
is the any way to proportionally enlarge the pictue ?
You can multiply Width and Height of PictureFrame with some scaling factor to scale it up or down. Then you might also have to adjust the X, Y position of it accordingly.