0

I am trying to reduce the width and height of a vertical photo to fit an image into a tkinter canvas on my screen. However it appears that when I call width,size=background2.size with PIL that it automatically considers the larger of the two numbers it's width and places the image on the canvas at a 90 degree angle. Is there any way to override this so I get a smaller vertical image to fit my screen? Thanks.

background2 = Image.open(background)
width,height = background2.size
if width > 1350 and height >700 and width > height:
    width = 1350
    height = 700
    resized_background = background2.resize((1350,700))
    resized_background.save('C:\\Users\\Kurt\\Desktop\\resized_background.jpg')
elif width > 467 and height > 700 and height > width:
    width = 467
    height = 700
    resized_background = background2.resize((467,700))
    resized_background.save('C:\\Users\\Kurt\\Desktop\\resized_background.jpg')

This returns (5184,3456) for my background2 image when in reality it is (3456,5134).

Tiger-222
  • 6,677
  • 3
  • 47
  • 60
wanderweeer
  • 449
  • 1
  • 6
  • 16
  • Could you upload the picture for our tests? – Tiger-222 Dec 22 '16 at 12:31
  • some devices save images rotated and adds information to display it unrotated - some programs don't use this information and you can see incorrect image. – furas Dec 22 '16 at 17:02
  • [Rotating an image with orientation specified in EXIF](http://stackoverflow.com/questions/13872331/rotating-an-image-with-orientation-specified-in-exif-using-python-without-pil-in) – furas Dec 22 '16 at 17:07
  • Thank you for the link. That will put me on the right track. – wanderweeer Dec 22 '16 at 22:52

0 Answers0