I have a little problem with UiPath. I want to insert images into placeholders in a PowerPoint. I can do this without any problem using the “Insert image into PowerPoint” activity. However, the problem is that we receive the images in different sizes, i.e. sometimes the images are 50.8 cm x 30.10 cm and sometimes 5 cm x 10 cm. This makes the images look extremely distorted in PowerPoint after insertion, depending on the image. Is there a way to easily insert images of different sizes in a PowerPoint?
I think the best way would be to resize the image before you insert it to your PowerPoint. Kindly go through the below links:
I got curious and tried it out
Here’s a sample workflow: ResizeImage.xaml (7.4 KB)
I have saved the image to my local folder but you can pass it on to your PowerPoint activity.
Thanks for your work. Can you maybe screenshot your activities/code so I can have a look at it. I am unable to download external files.
Here you go:
Code snippet inside Invoke Code activity:
Dim originalImage As System.Drawing.Image = imageVariable
Dim newWidth As Integer = 200 ' Set your desired width
Dim newHeight As Integer = 150 ' Set your desired height
Dim resizedImage As New System.Drawing.Bitmap(originalImage, newWidth, newHeight)
imageVariable = resizedImage
Argument passed is an image variable, type: System.Drawing.Image; Direction: In/Out.
Did that work? Let us know if you’re facing any challenges. Thanks!
What did you set as output for Load Image? A variable from the type System.Drawing.Image or what?