ojii / pymaging

Pure Python imaging library with Python 2.6, 2.7, 3.1+ support

Home Page:http://pymaging.rtfd.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flipping horizontally also flips vertically

pr1001 opened this issue · comments

I've been trying to flip an image both horizontally and then vertically in order to achieve a 180 degree rotation.

Using

flipped_horizontally_image = image.flip_left_right()
flipped_vertically_image = flipped_horizontally_image.flip_top_bottom()

the resulting image has the the same vertical orientation as the original image.

If I only use flip_left_right(), I find that the image is already flipped vertically in addition to horizontally, so flip_top_bottom() just ends up canceling out the vertical flip.

There's Image.rotate for this. Still a bug though. (The flip APIs have been mostly implemented to test a very simple operation when I started writing this library, I had no clue anyone would ever use it).

Jeeze, I feel really stupid for not seeing Image.rotate(). ;-p

Hmm, image.rotate(180) doesn't give the expected results. It seems to be rotated clockwise 90 degrees and then tiled.

the docs need quite some love, but that API is actually documented: http://pymaging.readthedocs.org/en/latest/dev/api.html#pymaging.image.Image.rotate

Thanks, but I don't see what I did wrong. Should I have disabled canvas resizing?

Sorry, missed that comment. It's quite possible this is broken. pymaging is still quite alpha and I focused mostly on thumbnailing. Having said that, if you could try to figure out why this doesn't work, that would be great!

also, uploading the original and output as well as the code you used would be useful

Maybe my Christmas present can be a pull request fixing this. Stay tuned... =)