I've build a PowerPoint 2010 toolbar that contains an "insert image" gallery for commonly used images. As a convenience, I have added a button to allow the user to browse to any image on their computer, then it copies the image file into the library folder that is the source for the gallery, and refreshes the ribbon to show the image in the gallery. Works fine.
My automation requires two copies of each image to be in the source folder. One is .PNG (to allow for transparency) and the other is .JPG to create the gallery thumbnail because MS Office doesn't like pngs in galleries. My add image routine takes the selected image, adds it temporarily as a shape on the current slide, then exports it twice into the target folder, once as a .PNG and again as a .JPG. This works fine too, except that in the process of exporting as a PNG it seems to be altering the dimensions of the file. The original might be a big .JPG that fills the screen, but what gets copied to the target folder is a smaller version. I'm opening the file with dimensions -1 which is supposed to keep original dimensions, and I can verify it is coming in big.
Does anybody know enough about the export method to explain to me why this is happening. See some code below.
Private Sub OKButton_Click()
picroot = Me.picrootbox.Value
Dim currentslide As Slide
Set currentslide = ActivePresentation.Slides(ActiveWindow.View.Slide.SlideIndex)
Set opic = currentslide.Shapes.AddPicture(FileName:=pickedpix, _
linktofile:=msoTrue, savewithdocument:=msoTrue, Left:=0, Top:=0, Width:=-1, Height:=-1)
'opic.ScaleHeight 1, msoTrue
'opic.ScaleWidth 1, msoTrue
exportpath = contentlibraryfolder & "\Images\Icons\" & picroot & ".png"
opic.Export exportpath, ppShapeFormatPNG ', opic.Width, opic.Height, ppScaleXY
opic.LockAspectRatio = True
opic.Width = 100
exportpath = contentlibraryfolder & "\Images\Icons\" & picroot & ".jpg"
opic.Export exportpath, ppShapeFormatJPG
You can see a couple places where I tried some code (now commented out) to resize the picture to original scale, but this makes no difference.
For example, the above code take a chosen picture 3264 x 2448 pixels @ 72 dpi, and saves is as a .png 383 x 287 pixels @ 96 dpi.