Hi. I'm trying to write a script to resize the image to 1200 pixels wide.
Everything seems to be working fine apart from the fact that all portrait-oriented photos are rotated 90° degrees.
The images are displayed correctly (in portrait orientation) in my camera roll.

But when I'm running the script they are rotated 90° degrees to landscape mode.

What am I doing wrong here?
Here is the script I'm using.
from PIL import Image
import photos
import console
image = photos.pick_image()
def customSize(image):
w, h = image.size
print 'Original image size: '+str(w)+' × '+str(h)+' pixels'+'\n'
if w > 1200:
wsize = 1200/float(w)
hsize = int(float(h)*float(wsize))
image = image.resize((1200, hsize), Image.ANTIALIAS)
print 'Modified image size: 1200 × '+str(hsize)+' pixels'
else:
print 'Image is too small to be resampled. Width is less than 1200 pixels'
return image
image = customSize(image)
image.show()
saveit = photos.save_image(image)
print 'Done!'