File size smaller after lossless rotation - normal?

Ask for help and post your question on how to use XnView MP.

Moderators: helmut, XnTriq, xnview

Benrasi
Posts: 6
Joined: Wed Dec 05, 2018 5:56 pm

File size smaller after lossless rotation - normal?

Post by Benrasi »

Is it normal that the file size is smaller after doing a lossless rotation?

The original file has 5262 KB, after only 4308 KB.

I notice in the EXIF a different Sub-sampling, but a better one in the rotated file. From 2x1, 1x1, 1x1 --> 1x1, 1x1, 1x1

Thanks,
Ben
cday
XnThusiast
Posts: 3350
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: File size smaller after lossless rotation - normal?

Post by cday »

Are you familiar with File > Format setting... > Write -- JPEG ?

It's rather hidden, but possibly the file has also been saved with a slightly lower Quality setting?
Benrasi
Posts: 6
Joined: Wed Dec 05, 2018 5:56 pm

Re: File size smaller after lossless rotation - normal?

Post by Benrasi »

I know the setting, but it should not influence the lossless - otherwise it would be the wrong name :-) - but to make sure I checked with a much lower save quality setting and it has no result on the described difference. Normal rotation and save is done with this setting, I approved.

Can anyone try to loosless rotate an image and check the file size ?

I'm running version 0.92 on Kubuntu Linux.
User avatar
xnview
Author of XnView
Posts: 38282
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: File size smaller after lossless rotation - normal?

Post by xnview »

the data is not changed, only compression...
Pierre.
fromorbonia
Posts: 2
Joined: Mon Sep 05, 2022 10:27 pm

Re: File size smaller after lossless rotation - normal?

Post by fromorbonia »

Hi - sorry silly question, same behaviour on v1.0 and v.1.02, a significant drop in file size using the "lossless rotation" tool.

I don't quite follow your reply "the data is not changed, only compression...". If the compression changes, then the images changes, and so the data has to change. I would expect "lossless rotation" to not change the file size at all?

Checking the file size is also a simple check to show I haven't accidently used the incorrect rotation tool (or done something else).


Thanks!
User avatar
helmut
Moderator
Posts: 8665
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Re: File size smaller after lossless rotation - normal?

Post by helmut »

xnview wrote: Wed Jan 02, 2019 11:13 am the data is not changed, only compression...
Compression is more efficient and results in smaller file while keeping the image information identical - right, Pierre?
fromorbonia
Posts: 2
Joined: Mon Sep 05, 2022 10:27 pm

Re: File size smaller after lossless rotation - normal?

Post by fromorbonia »

Thanks helmut - but JPEG isn't a lossless compression.
It would be great to get a confirmation of what is going on.
User avatar
helmut
Moderator
Posts: 8665
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Re: File size smaller after lossless rotation - normal?

Post by helmut »

fromorbonia wrote: Mon Sep 12, 2022 9:22 pm Thanks helmut - but JPEG isn't a lossless compression.
It would be great to get a confirmation of what is going on.
JPEG lossless transformations rearrange the compressed data (DCT coefficients) without (re)compressing image data. Unlike saving a file in JPEG format these transformations are lossless.

Manul pages of jpegtrans provides interesting background information:
https://manpages.ubuntu.com/manpages/xe ... ran.1.html

Related topic:
JPEG Lossless question. Why is the file size smaller?
User avatar
XnTriq
Moderator & Librarian
Posts: 6064
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: File size smaller after lossless rotation - normal?

Post by XnTriq »

XnView also optimizes Huffman tables during lossless transformations.

Related: Lossless flip/rotate