File size smaller after lossless rotation - normal?

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

Moderators: XnTriq, helmut, 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: 3948
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: 43141
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
Posts: 8705
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
Posts: 8705
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: 6320
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
esv
Posts: 43
Joined: Fri Sep 16, 2022 1:04 pm

Re: File size smaller after lossless rotation - normal?

Post by esv »

I see that lossless translation doesn't respect the Settings→Formats→Write→JPEG "Optimize Huffman table"
Even when it's off, the file size still changes.

I understand that by default this is a good option — you get free space for free :) But it can also be confusing
So maybe to allay some concerns like those aired in the OP as it's indeed the easiest thing to check that the file size hasn't changed (and alternative methods require more knowledge) to maybe add an extra option specifically for the lossless rotations that would allow do toggle any optimizations and just produce the results identical to the jpegtran tool etc, so that if you rotate the original 4 times you'll get exactly the same file as the original and be certain without any doubt (and this certainty is sometimes more valuable than the space savings) that everything is wholesome and lossless!

Or at least respect the already existing option

Another idea: maybe on the first lossless rotation you could add a warning that optimizations are enabled but default, but don't produce any quality loss?
User avatar
XnTriq
Moderator & Librarian
Posts: 6320
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: File size smaller after lossless rotation - normal?

Post by XnTriq »

esv wrote: Wed Dec 07, 2022 6:47 pmI see that lossless translation doesn't respect the Settings→Formats→Write→JPEG "Optimize Huffman table"
Even when it's off, the file size still changes.
Hello esv (-:
XnTriq wrote: Sun Apr 10, 2016 1:45 amI'd like to request an option to prevent XnView from optimizing the Huffman tables during lossless transformations.
esv
Posts: 43
Joined: Fri Sep 16, 2022 1:04 pm

Re: File size smaller after lossless rotation - normal?

Post by esv »

upd: I've added a suggestion to the proper forum section about this viewtopic.php?f=60&t=44412

Sorry, stopped scrolling at May 2016, so didn't see your message :)
(side note: wish there were a proper request tracker so I could just upvote/follow your existing request; meanwhile will create a new suggesting dedicated just to this to maybe help with this)
User avatar
XnTriq
Moderator & Librarian
Posts: 6320
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: File size smaller after lossless rotation - normal?

Post by XnTriq »

esv wrote: Fri Dec 09, 2022 6:21 amupd: I've added a suggestion to the proper forum section about this viewtopic.php?f=60&t=44412

Sorry, stopped scrolling at May 2016, so didn't see your message :)
(side note: wish there were a proper request tracker so I could just upvote/follow your existing request; meanwhile will create a new suggesting dedicated just to this to maybe help with this)
Very well written :-) Thank you!
I was looking for a forum software or an extension for phpBB a while back, but didn't find anything that fit the bill.
BTW: There's a bug tracker.
esv
Posts: 43
Joined: Fri Sep 16, 2022 1:04 pm

Re: File size smaller after lossless rotation - normal?

Post by esv »

XnTriq wrote: Fri Dec 09, 2022 12:30 pm BTW: There's a bug tracker.
Well, you can't really use that, as far as I understand, you can't even subscribe to a bug (no to mention file one or "like" someone else's)

XnTriq wrote: Fri Dec 09, 2022 12:30 pm I was looking for a forum software or an extension for phpBB a while back, but didn't find anything that fit the bill.
Don't know much about various alternatives, but what about Discourse? From seeing it on a few forums, it's pretty good, definitely better than this outdated phpBB