Lossless Rotation based on Exif / Size change

*** Please report new bugs here! ***

Moderators: xnview, Dreamer

NicoPL
Posts: 9
Joined: Sun Jun 25, 2017 10:24 am

Lossless Rotation based on Exif / Size change

Post by NicoPL »

Hello,

I use the JPEG Lossless Transformation - Rotate based on Exif orientation field.
I select all the photos in one folder, and apply this transformation on every ones.

What I don't understand is:
- why there is a change of the size of the files that are rotated change whereas the height and the width are multiple of 8 pixels.
- why there is a change of the size of the files that are not rotated.

If there is a change of the file size, it means that their is a loss of data.

Thank you in advance !

Best

NicoPL
User avatar
xnview
Author of XnView
Posts: 48174
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Lossless Rotation based on Exif / Size change

Post by xnview »

There is an optimization of huffman table so little change in size without loss
NicoPL
Posts: 9
Joined: Sun Jun 25, 2017 10:24 am

Re: Lossless Rotation based on Exif / Size change

Post by NicoPL »

Thanks for the answer.
When you say little, what's little?
The file size drops by more than 1Mo. For instance from 8.8 to 7.6 or 7.5 to 6.2Mo
NicoPL
Posts: 9
Joined: Sun Jun 25, 2017 10:24 am

Re: Lossless Rotation based on Exif / Size change

Post by NicoPL »

I did a new test. Two photos, one with the EXIF saying that it needs to be rotated, one already horizontal by nature.
The only changes in Exiftool are the following:

Photo that needed to be rotated
# Original
- File Size : 8.6 MB
- Orientation : Rotate 90 CW
- Y Cb Cr Sub Sampling : YCbCr4:2:2 (2 1)
# New file - Rotated
- File Size : 7.3 MB
- Orientation : Horizontal (normal)
- Y Cb Cr Sub Sampling : YCbCr4:4:0 (1 2)

Photo that didn't need to be rotated
# Original
- File Size : 7.7 MB
# New file - Not rotated
- File Size : 6.7 MB

I still can't understand why there is such a drop in file size.
Thanks in advance for your help. I really have to make sure that computing this operation doesn't alter the quality of my pictures.

Best
User avatar
xnview
Author of XnView
Posts: 48174
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Lossless Rotation based on Exif / Size change

Post by xnview »

NicoPL wrote: I still can't understand why there is such a drop in file size.
Thanks in advance for your help. I really have to make sure that computing this operation doesn't alter the quality of my pictures.
The compressed data of JPEG data are not changed, only huffman table
NicoPL
Posts: 9
Joined: Sun Jun 25, 2017 10:24 am

Re: Lossless Rotation based on Exif / Size change

Post by NicoPL »

Thank you for your answer.

To summarize:

When asking xnview to perform a batch rotation based on the exif field, it rotates the photo if needed, and whatever the rotation it changes the Huffman's table. This update of the Huffman's table results in a 15% drop of the file size. Is that correct?

My camera is brand new. I assumed that Panasonic knew how to implement optimized codes in their chipsets and therefore am still surprised of such a drop... 15% is a lot.
User avatar
xnview
Author of XnView
Posts: 48174
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Lossless Rotation based on Exif / Size change

Post by xnview »

send me the original & rotated files?