Cropping an image in Cards.py
I want to crop the images used in the Cards.py example. But I can't figure out how.
Do I do it in the line
card.card_image = images[i]
or the line
card.image = card.card_image
and if so then how?
I've tried everything I can think of: Image.crop, ImageOps.crop, card.crop, card.card_image.crop, card.image.crop, images[i].crop but I appear to be missing something
From the docs,
Layer.imagetakes a filename, not an actual image.
So you can't do any of the operations you tried, unless you load the file yourself as a PIL image, crop it, then write the file somewhere that you can read it.
If you use
scene.image(name, x=0, y=0, w=0, h=0[, from_x, from_y, from_w, from_h])rather than the built in Layer property to draw your image, the
from_xetc parameters handle cropping. No doubt that complicates things.
Thanks for the suggestions. In the end I decided to use the first method. A little slow but it worked.