Open marcill1 opened 11 months ago
I'm not sure, but am also having the same issue. Tried looking around online, but couldn't find any relevant answers.
K told me to just drag the image from the folder and drop it directly on to the presentation file. It works for me, but I still can't find a way to adjust figure size.
ah thanks so much! that's better than no picture at all:)
This worked, thank you! I guess you'd have to adjust the figure size externally.
I resized the images in python, and they all fit the slide now. Thanks for the suggestion!
Sun could you show an example of how you did that? TIA!
Sure thing!, this is my code to add whitespace to both sides of the image. You need whitespace because resizing alone won't work. If you run this code with your image in the same folder as this code, it will return the original size in pixel. Then, you can change the "new_width" so that they are larger than the original width.
from PIL import Image, ImageOps
def resize_with_whitespace(input_path, output_path, new_width):
original_image = Image.open(input_path)
# Calculate the new height to maintain the aspect ratio
print("Original size:", original_image.size)
original_width, original_height = original_image.size
new_height = original_height
# Create a new image with the desired size and white background
new_image = Image.new("RGB", (new_width, new_height), "white")
# Paste the original image onto the new image, centering it
offset = ((new_width - original_width) // 2, (new_height - original_height) // 2)
new_image.paste(original_image, offset)
# Save the result
new_image.save(output_path)
# Example usage:
input_image_path = "image.png"
output_image_path = "image_resized.png"
new_width = 3600 # Adjust this to your desired width
resize_with_whitespace(input_image_path, output_image_path, new_width)```
Thank you so much! this is so helpful!
I'm having an error with images not appearing on my slides. They either will not show up at all or just appear like this:
However, the images do load just fine in jupyter notebook. How would I fix this?