Bug fix when rotating or mirroring an image.