[BUG] All images inserted using base64 are forced into 16:9 ratio
We appreciate your feedback - to help the team understand your needs please complete the following template to ensure we have the details to help.
Submission Guidelines
- If you are not using the latest release, please update and see if the issue is resolved before submitting an issue
- General questions or high-level topics should be posted in Discussions
- Please browse the online Documentation to see if your question is already addressed there
Issue Category
- [ ] Enhancement
- [x] Bug
- [ ] Question
- [ ] Documentation gap/issue
Product Versions
- Please specify what version of the library you are using......: [ 3.14.0]
- Please specify what version(s) of PowerPoint you are targeting: [2407]
- Please specify what web browser you are using.................: [Chrome]
Desired Behavior
I can add an image via base64 of any image ratio and see that image at the correct ratio in my slide.
Observed Behavior
Sizing methods all work correctly (cover & contain). But it is stretching the image, regardless of original image size, to a ratio of 16:9. This is regardless of addImage size or the size I provide in the sizing options. If I set the sizing type to "cover", it will cover the space, but the image is still clearly warped. (See the image below: the original is 320x400.
This is not the final code we want, but this is what I am testing it with to make sure it isn't the sizing properties causing the issue:
slide.addImage({ data: base64String, x: '5%', w: '50%', y: '10%', h: '50%', sizing: { type: 'contain', w: '50%', h: '50%', }, })
I have double checked the base64 being inserted, and it is accurate to the image I want. We are using an image url in another place, but it is being used in a way that makes it harder to discern the aspect ratio. It appears to be warped as well.
Steps to Reproduce
- Create a new pptx file
- Create a new slide
- Convert an image to base64 string and add to slide using the code above
- Write the file
- OBSERVE: the ratio of the image is not preserved, is coerced into 16:9 ratio