python-pillow/Pillow — pull request #994 by homm (2014-11-07 01:57:57+00:00)
Title: Add transpose and speedup rotation

This adds new `Imaging.TRANSPOSE` method for `Image.transpose()` operation. Also this speeds up `Image.ROTATE_90` and `Image.ROTATE_270`.

Method | Before | After
-------|--------|------
**Large 5120x2880 image** |
Flip left right | 0.02635 | 0.0262
Flip top bottom | 0.01105 | 0.011
Rotate 90 | 0.3706 | 0.04535
Rotate 180 | 0.02968 | 0.02933
Rotate 270 | 0.3786 | 0.04542
Transpose | | 0.04404
**Small 586x387 image** |
Flip left right | 0.0003951 | 0.0003891
Flip top bottom | 0.0001121 | 0.000108
Rotate 90 | 0.000602 | 0.000457
Rotate 180 | 0.000464 | 0.000463
Rotate 270 | 0.0005708 | 0.0004828
Transpose | | 0.0004091

As you can see, this doesn't improve performance for relatively small images, because they whole fit in cache, but for large images this gives 8x speedup.

Tests pending.