Rotating a JPEG without re-encoding it

Quarter turns and flips take a lossless path that rearranges the existing data instead of decoding and re-compressing.

3 min read

Why the angle you choose changes the method

Re-saving a JPEG always costs a little quality, because the format is lossy and every encode throws away a bit more. Rotate a photo four times through a naive tool and you can see the difference.

For 90, 180 and 270 degrees that loss is avoidable. A JPEG is stored as a grid of blocks, and those blocks can be rearranged into the rotated order without ever being decoded into pixels. That is what happens here for quarter turns and flips: the compressed data is moved, not re-compressed, and the result is bit-for-bit as good as the original.

An arbitrary angle cannot work that way. Turning an image 7 degrees means computing pixels that did not exist before, so that path decodes, rotates and re-encodes, and fills the newly exposed corners with a background colour you choose.

A different angle for each file

Photos taken in one sitting are often wrong in different ways — some need a quarter turn left, some a turn right, some are fine. Rotating them as a single batch with one setting means running the tool three times.

So each file in the batch carries its own angle. Set them individually, process once, and everything comes back in one download.

Orientation tags

Cameras usually record the picture as the sensor saw it and add a tag saying which way up it should be shown. Software that ignores the tag displays the photo sideways, which is why an image can look correct in one program and wrong in another.

That tag is read and applied here, and the result is written the right way up with the tag cleared — so the file looks the same everywhere afterwards, rather than depending on whether the viewer honours it.

Frequently asked questions

Does rotating lose quality?
Not for 90, 180 or 270 degrees, or for flips — those take the lossless path. An arbitrary angle requires re-encoding, so there is a small cost.
What happens to the corners at an angle like 30 degrees?
The canvas grows to fit the turned image and the newly exposed corners are filled with the background colour you pick, including fully transparent if the output format supports it.
Can I rotate several images at once?
Yes, up to thirty per task, and each one can have its own angle. More than one output arrives as a single ZIP.