JPEG is a lossy compression scheme, so decompression-manipulation-recompression normally reduces the image quality further for each step. Is it possible to rotate a JPEG image without incurring further loss? From what little I know of the JPEG algorithm, it naively seems possible to avoid further loss with a bit of effort. Which common image manipulation programs (e.g. GIMP, Paint Shop Pro, Windows Photo Gallery) and graphic libraries cause quality loss when performing a rotation and which don't?
The actual rotation by 90,180,270 degrees will not have any effect on the image quality at all. Having said that if you start with a JPG file and rotate in PhotoShop and resave the image will be recompressed and loose some quality. If you want to only rotate a JPG use a program that supports lossless rotation.
To perform a lossless left/right rotate or vertical/horizontal flip, go to Tools > JPEG Lossless Rotate. Alternatively, you can also find the Tools menu by right clicking on the image. The rotate clockwise or counterclockwise icons are also lossless for JPEG files.
If you're asking if lossy compression is reversible, the answer is: no. The lossy image process is irreversible. Once you have compressed an image this way, you can't go back.
There is a program named jpegtran
jpegtran – a utility for lossless transcoding between different JPEG formats.
To rotate the image losslessly, you can do the following:
$ jpegtran -rotate 180 -perfect -outfile rotated.jpg origin.jpg
And Here is a list of applications which provide the JPEG lossless rotation feature based on the IJG code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With