0

I want to show a set of images in a folder, suppose the folder has 100 images and I want to show the first 10 in grid order.

and also having the same size 300x300

If the image is larger than 300x300 rescale.

enter image description here

I have this code but I don't know how to rescale the image to size 300 * 300

from IPython.display import Image
from IPython.display import display
x = Image(filename="/content/workspace/model/SAE_preview_SAE masked.jpg") 
y = Image(filename="/content/workspace/model/SAE_preview_SAE masked.jpg") 
display(x, y)
molo32
  • 387
  • 1
  • 3
  • 6
  • 2
    Show us some code, or tell what did you tried already. We are here to help with some particular problem, not to write whole code for you. – Misieq Sep 16 '19 at 06:20

1 Answers1

0

How do I resize an image using PIL and maintain its aspect ratio?

This would solve the resizing issue. You can ignore aspect ratio if you do not need that.

There after using glob module of python could display all the images in the folder.

https://docs.python.org/3.7/library/glob.html

aayush_malik
  • 161
  • 13