1
I’m having a little trouble implementing the following situation:
- Read a folder with multiple images;
- I have to read the images and resize each one to 720x185 resolution;
I was able to resize the image as the following code.
from PIL import Image
path = 'informe o caminho da imagem'
image = Image.open(r"" + path + "")
image = image.resize((720,185))
image.save(path)
However, I have square images where they get distorted, so what I needed to do was this:
- Generate a blank image at 720x185 resolution;
- Insert the read image in the center of the new created image, respecting only the height. With this, I believe that it would not be distorted;
How can I accomplish this task?
Interesting your idea but my main problem is that the height needs to be 185 or it is necessary to have the width of 720 and height of 185 in some cases in the images I checked they stay with the 720 of width but with a height superior to 185 some idea of how to reverse this situation?
– Eder Luca