Rotation differs for different image formats.
JPEG file format is supposes some quality loose if the image is decoded and then encoded back to JPEG file. Thus if usual rotation is performed, the following two options (or something in between) are available:
- Create new JPEG file with highest image quality – in this case the file size will grow and will be several times bigger than the original one
- Create new JPEG with lowest quality - the size of the new file will not grow but the image will significantly degrade in quality
There is a solution for this problem: lossless JPEG image rotation.
A little bit of theory: JPEG images are stored as a number of relatively small independently encoded rectangular blocks of 8x8 up to 16:8 pixels, called Minimum Coded Units (MCU). MCUs can be rotated in 90 degree steps or flipped without having to be decompressed into bitmap and re-compressed back to JPEG. This means that JPEG images can be rotated in 90 degree steps and flipped without loss in quality. With lossless JPEG rotation an image is treated as a collection of MCU blocks rather than individual pixels (in fact, the image is never decoded to pixels for lossless rotation).
CelesteCS Image Lossless Rotator plugin implements lossless JPEG rotation.
There are some limitations which do not allow lossless rotation of some JPEGs, but in most cases the plugin rotates images truly lossless. JPEGs, which cannot be rotated with lossless technology, are rotated with high quality, so high quality is more preferable than the file size.
PNG and GIF files
PNG and GIF file formats do not suppose quality lose during recompressing, from one side. From the other side these formats do not suppose fast rotation by changing some internal structures, like in JPEG format.
CelesteCS Image Lossless Rotator plugin rotates PNG and GIF images by simply reading an image, rotating it and compressing again. The resulting image has the same quality and almost the same file size.