rotate
Rotate by 90/180/270 degrees and/or flip horizontally or vertically.
Rotate and/or flip. At least one of --degrees/--flip is required; both can be given together.
rotate <inputs...> [--degrees 90|180|270] [--flip x|y|both] [--format …]
Flags
| Flag | Meaning |
|---|---|
--degrees 90|180|270 |
rotation, clockwise. |
--flip x|y|both |
x mirrors left↔right (horizontal flip), y mirrors top↔bottom (vertical flip), both is equivalent to a 180° rotation. |
--format keep|jpeg|png|webp |
output format. Default keep. |
rotate needs --degrees or --flip (or both) — calling it with neither is a usage error. Like
crop, it has no --to flag, and a re-encoded JPEG source pays the same fixed quality-92 pass
crop does, for the same reason (see crop).
Examples
imagekbreducer rotate photo.jpg --degrees 90
imagekbreducer rotate photo.jpg --degrees 180 --flip x --format jpeg
What can go wrong
| Exit | When |
|---|---|
| 2 | neither --degrees nor --flip given; --degrees not one of 90/180/270; --flip not one of x/y/both; --format invalid |
| 3 | an input doesn’t exist, or a glob matched nothing |
| 4 | the computed output already exists and isn’t the input |
| 20–24 | engine-side failures — see Exit codes |
Like crop, rotate never produces exit codes 10–13 and targetBytes in the
--json envelope is always null.