YasserKhalil
YasserKhalil

Reputation: 9568

Enlarge picture using Pillow package keep ratio

I am trying to use python pillow package to enlarge picture and here is my try

from PIL import Image

image = Image.open('Sample.jpg')
new_image = image.resize((1080, 1080))
new_image.save('Output.jpg')

The code is working but the output image loses completely the ratio. How can I enlarge the image without losing the quality?

Upvotes: 0

Views: 37

Answers (1)

Ziming Shan
Ziming Shan

Reputation: 146

What you're talking about is image upscaling, which is a more complex problem just than enlarging the image. I recommend looking into image upscaling packages. A lot of them use CNNs for this.

Upvotes: 1

Related Questions