ojii / pymaging

Pure Python imaging library with Python 2.6, 2.7, 3.1+ support
http://pymaging.rtfd.org
Other
245 stars 29 forks source link

Flipping horizontally also flips vertically #30

Open pr1001 opened 11 years ago

pr1001 commented 11 years ago

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.

ojii commented 11 years ago

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).

pr1001 commented 11 years ago

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

pr1001 commented 11 years ago

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

ojii commented 11 years ago

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

pr1001 commented 11 years ago

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

ojii commented 11 years ago

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!

ojii commented 11 years ago

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

pr1001 commented 11 years ago

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