Forum Archive

Resize image script not working after update

Gustaphzon

Hi.

I borrowed a script from macdrifter.com and changed it little. It worked perfect, but after the update to 1.4 it runs without errors but don't resize the image. It only saves a new image in the same size as the original. Here is the code

import Image
import photos
import console

img = photos.pick_image()

def customSize(img):
    w, h = img.size
    print 'w: ' + str(w)
    print 'h: '+ str(h)
    if w != 1000:
        wsize = 1000/float(w)
        print 'wsize: '+str(wsize)
        hsize = int(float(h)*float(wsize))
        print 'hsize: ' + str(hsize)

        img = img.resize((1000, hsize), Image.ANTIALIAS)
    return img

image = customSize(img)
print image.size
image.show()

saveit = photos.save_image(img)

print "\n\n Bilden sparad"

I'm a beginner and don't understand why this happens. Can someone please help me.

omz

In the second last line, it should be photos.save_image(image) instead of photos.save_image(img).