PptxGenJS allows creating a Powerpoint file by scripting. https://gitbrent.github.io/PptxGenJS/
we can add an image as follows:
slide.addImage({ path: "images/chart_world_peace_near.png", x:..., y:..., w:..., h:...});
I need to resize the image to the full size of the slide, with the aspect ratio. So, I need to know the size of the image and the size of the slide, as follows:
scaled_image_width = slide_width
scaled_image_height = image_height * scaled_image_width / image_width;
if (scaled_image_height > slide_height) {
scaled_image_height = slide_height
scaled_image_width = image_width * scaled_image_height / image_height;
}
However, I don't see a way in PptxGenJS to get the size of the image and the size of the slide. How can I achieve this?
You can add background to slide using below
After adding slide you can add background to it