Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a JPEG compressed image be rotated without a loss in quality?

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?

like image 717
Mat Avatar asked Feb 12 '09 21:02

Mat


People also ask

Does rotating an image affect quality?

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.

How do I rotate a picture without losing quality?

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.

Is JPEG compression reversible?

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.


1 Answers

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

like image 133
kcwu Avatar answered Sep 23 '22 11:09

kcwu