rotate

rotate pixels a given amount of 90 degree turns

$ pierogis rotate ./input.jpg -t 1 --ccw
rotated gnome

very chill.

Use -t to indicate the number of turns (defaults to 1).

Use -a to indicate the degree magnitude of each turn (defaults to 90).

Use --ccw to turn counterclockwise instead.

Use --resample-filter to define a PIL resample filter (defaults to nearest neighbor).

See PIL documentation on filters.

choices = {
    'default': Image.NEAREST,
    'nearest': Image.NEAREST,
    'box': Image.BOX,
    'bicubic': Image.BICUBIC,
    'bilinear': Image.BILINEAR,
    'hamming': Image.HAMMING,
    'lanczos': Image.LANCZOS,
}

sort uses this under the hood.

arg

description

default

valid

-t, --turns

number of clockwise turns

1

0-3

-a, --angle

degrees to rotate through each turn

90

int

--ccw

if provided, turns will be applied counter-clockwise instead

False

flag

--resample-filter

a filter to be used with resizing

'nearest'

str

See: RotateFilling, Rotate