Super
Super

Reputation: 23

When I crop an image in Python, it returns 'NoneType'

croppedImage = image.crop(200, 200, 200, 200)

window = Window(800, 800)

window.add(croppedImage)

window.wait()

window.close()

Error message: ParameterTypeError: Incorrect type for parameter 'graphic' : NoneType, expected GraphicalObject

Upvotes: 2

Views: 183

Answers (1)

lvc
lvc

Reputation: 35089

This usually means that the crop function works by changing the image object it is applied to, instead of creating a new one - ie, you want to do this:

image.crop(200, 200, 200, 200)
window.add(image)
window.wait()
window.close()

Upvotes: 8

Related Questions