[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] transform.chop and image cropping



Hi

see below:

David Gowers schrieb:
On 9/2/07, Brian Fisher <brian@xxxxxxxxxxxxxxxxxxx> wrote:
There's also another artist technique where empty space is
deliberately used as a way of being able to set an image hotspot (the
origin of the image). Basically no file format gives you a way to set
a hotspot, but if the image loader assumes the center of the image is
the hotspot then the artist can render images to take advantage of
that. For it to work the image loader needs to be aware of the meaning
of the empty space.

wow that's useful, I hadn't thought of that.


[snip]

You could store the hotspot in the file name e.g.:

hero_200_300.png

That would mean you have the hotspot at 200/300. Of course you would have to parse the name and all images need that name convention. You can get the image dimensions in pygame using get_size(), but you know that ;-). You could encode even more information into the filename if you want, but then it will be more complex to parse.

~DR0ID