0

I am trying to use Image.resize from PIL to resize an image. However, when it resizes the image it crops off about 5% from the left side of the image. Any idea how to keep it from cropping the image? Here's my code:

imgOut = Image.open('sample-out.jpg')
new_img = imgOut.resize((640,384), Image.ANTIALIAS)
new_img.save("small-out.jpg", "JPEG", optimize=True)
DasPete
  • 831
  • 2
  • 18
  • 37
  • Not enough information. Even so: does `Image.resize` maintain the original aspect ratio? – Jongware Oct 02 '18 at 20:37
  • Possible duplicate of [How do I resize an image using PIL and maintain its aspect ratio?](https://stackoverflow.com/questions/273946/how-do-i-resize-an-image-using-pil-and-maintain-its-aspect-ratio) – Peter Wood Oct 02 '18 at 20:39
  • I also suspect that the new size may have another ration than the original. Also: do you use the "real" PIL or Pillow? PIL wasn't updated in 8 years, I suggest using Pillow https://pypi.org/project/Pillow/ – deR_Ed Oct 02 '18 at 20:39
  • Looks like the full Pillow did the trick. Thanks for the help! – DasPete Oct 02 '18 at 21:00

0 Answers0