Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] All images inserted using base64 are forced into 16:9 ratio #1351

Open
1 of 4 tasks
luketpena opened this issue Sep 16, 2024 · 0 comments
Open
1 of 4 tasks

[BUG] All images inserted using base64 are forced into 16:9 ratio #1351

luketpena opened this issue Sep 16, 2024 · 0 comments

Comments

@luketpena
Copy link

luketpena commented Sep 16, 2024

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
  • 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.

image

Steps to Reproduce

  1. Create a new pptx file
  2. Create a new slide
  3. Convert an image to base64 string and add to slide using the code above
  4. Write the file
  5. OBSERVE: the ratio of the image is not preserved, is coerced into 16:9 ratio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant