[Solved] Disable embedded thumbnails on lossless jpeg rotation

Having tech problems? Post them here and do not worry, there is always a solution for you.
Post Reply
es
Posts: 114
Joined: Sun Dec 04, 2022 6:24 pm

[Solved] Disable embedded thumbnails on lossless jpeg rotation

Post by es »

TLDR: when losslessly rotating jpegs in the Viewer (but not in the Editor)
  1. GC adds generates embedded thumbnails (Thumbnail IFD in addition to IFD0) for files that had no EXIF, but
  2. does NOT add embedded thumbnails for files that had EXIF (IFD0, Exif IFD) that were generated with GC with store exif preview disabled
How to make GC never generate embedded thumbnails?
How to make editor rotations to also be lossless?

My settings (the ones I think might be relevant, but I'm not familiar with all of them):
  • Browser ⟶ Edit ⟶ JPEG ⟶Rotate always lossless (may add margins to the image)
  • Browser ⟶ General ⟶ Thumbnails Generation
    • ⟶ Fast (use only available icons)
    • ⟶ (disabled) Always recreate preview
    • ⟶ (disabled) Always recreate preview of JPEGs,...
    • ⟶ (disabled) Use EXIF Preview...
  • Browser ⟶ Thumbnails & Icons ⟶ Thumbnails
    • ⟶ (disabled) Always recreate JPEG previews
With these settings I'd expect any editing operations to NOT generate any embedded thumbnails, I don't ever want them in the files, only in the database.

However, if I rotate a jpeg that has no EXIF (empty Exif tab in the preview area) in the Viewer, embedded thumbnails do get generated, so I get two EXIF fields (Thumbnail IFD in addition to IFD0)
But then if instead of rotating I export the same file within GC to another jpeg (but disable store exif preview in the additional options) and then rotate this newly generated file (now it has two Exif fields: IFD0 and empty Exif IFD), I get no thumbnails.
I've also noticed that when I open the original noexif file in GC for editing and rotate it with the same shortcut there and then save, I don't get any Exif fields, not even IFD0
After enabling "Show options dialog" in OpenImage formats for JPEG I see that saving after rotation shows up this dialog, so I assume the save operation in not lossless, but a complete recompression. Is there a way to also force lossless rotation in the Editor?

Finally, how to make sure that lossless rotation never generates embedded thubnails?

Thanks!

P.S.
Side question: is there an option to run a batch deletion of any existing embedded thumbnails? Or even to auto-delete them while browsing files?
User avatar
forum_adm
Site Admin
Posts: 1814
Joined: Fri Dec 23, 2016 9:41 am
Location: Germany
Country: Germany
Contact:

Re: Disable embedded thumbnails on lossless jpeg rotation

Post by forum_adm »

Please download the latest BETA:
http://www.lemkesoft.org/beta.html

The browser will now only write a thumbnail if the original files contains a thumbnail.

The editor can't rotate lossless. Just use the browser for this.

You can remove existing thumbnails with the following command:
Screenshot 2022-12-06 at 07.04.26.jpg
Screenshot 2022-12-06 at 07.04.26.jpg (416.13 KiB) Viewed 980 times
Thorsten
es
Posts: 114
Joined: Sun Dec 04, 2022 6:24 pm

Re: [Solved] Disable embedded thumbnails on lossless jpeg rotation

Post by es »

The browser will now only write a thumbnail if the original files contains a thumbnail.
Thank you, can confirm it's working
You can remove existing thumbnails with the following command:
Thanks!
The editor can't rotate lossless. Just use the browser for this.
Ok, but that's tricky to remember especially if a lossless crop in the editor is added (not filed this suggestion yet). I basically want to make sure that it's much harder to ruin a jpeg on simple ops, so that all operations that can be lossless are lossless and you'd need to go through extra steps to introduce a loss.
Would you please add an option for the Editor to also go through the jpeg lossless pipeline?
es
Posts: 114
Joined: Sun Dec 04, 2022 6:24 pm

Re: [Solved] Disable embedded thumbnails on lossless jpeg rotation

Post by es »

Ok, so I've tested this a bit more, trying to compare to what the jpegtran cli tool is doing and GC still does some extra EXIF manipulation

I've attached both the original rr.jpg file and the same file after being rotated 4 times losslessly (from the Browser, not the Editor) and the rotated file gets and extra IFD0 field "Orientation of image:" (though it's the same regardless of the orientation, so not sure what it means) as well as the whole new "-- Thumbnail IFD --" (see below copies of the text I see in the "Exif" preview tab within GC). Previously I looked at "ExifTool" output, which displays it as "---- IFD1 ----", not "Thumbnail IFD", so I assumed it was fixed, but maybe not (or maybe yes and it's just named incorrectly?)?

Basically, is it possible to adjust GC to make sure it doesn't do anything extra when doing lossless operations with JPEGs besides rotating the image bits? No need for any thumbnail info, nor any other additonal info, etc.?


Original

Code: Select all

-- IFD0 --
X resolution:
144.0 ppi (pixel per inch)
Y resolution:
144.0 ppi (pixel per inch)
Resolution unit:
inch
-- Exif IFD --
Valid image width in pixel:
80
Valid image height in pixel:
80
Rotated 4 times in GC

Code: Select all

-- IFD0 --
Orientation of image:
1
X resolution:
144.0 ppi (pixel per inch)
Y resolution:
144.0 ppi (pixel per inch)
Resolution unit:
inch
-- Exif IFD --
Valid image width in pixel:
80
Valid image height in pixel:
80
-- Thumbnail IFD --
Compression scheme:
JPEG
Orientation of image:
1
X resolution:
72.0 ppi (pixel per inch)
Y resolution:
72.0 ppi (pixel per inch)
Resolution unit:
inch
Attachments
rr rotated 4 times.jpg
rr rotated 4 times.jpg (8.67 KiB) Viewed 969 times
rr.jpg
rr.jpg (8.58 KiB) Viewed 969 times
User avatar
forum_adm
Site Admin
Posts: 1814
Joined: Fri Dec 23, 2016 9:41 am
Location: Germany
Country: Germany
Contact:

Re: [Solved] Disable embedded thumbnails on lossless jpeg rotation

Post by forum_adm »

Please recheck with build 5690 tomorrow. I found and fixed an issue.
es
Posts: 114
Joined: Sun Dec 04, 2022 6:24 pm

Re: [Solved] Disable embedded thumbnails on lossless jpeg rotation

Post by es »

Ok, thanks for fixing the issue, now the picture rotated 4 times in the browser is identical to the original!!!

Now the only issue remaining is the Editor not using lossless pipeline when it can. Would you please also fix this? Given that jpegs are rather bad at generation loss, it would be great if unsuspecting users didn't lose any quality when possible, and with rotation that's definitely possible, it just needs to be also made convenient!
User avatar
forum_adm
Site Admin
Posts: 1814
Joined: Fri Dec 23, 2016 9:41 am
Location: Germany
Country: Germany
Contact:

Re: [Solved] Disable embedded thumbnails on lossless jpeg rotation

Post by forum_adm »

Sorry, that is not supported in the editor workflow. That would be too much work.
es
Posts: 114
Joined: Sun Dec 04, 2022 6:24 pm

Re: [Solved] Disable embedded thumbnails on lossless jpeg rotation

Post by es »

Ok, would it be possible to maybe add another "lossless rotate" function to leave the current Editor rotation pipeline intact? That's how XnViewMp does it — it has a regular rotate command and a lossless rotate command, but then the lossless rotate command works both in the Browser and in the Editor

Or would it be at least possible to show a user warning (Note in GC) when you try to rotate a JPEG, saying that it's not lossless and if you don't want to lose any quality you should perform the operation in the Browser?

I'm just worried that if I switch to GC for the simple edits I'll easily forget that it's not fully lossless (the Editor view is nicer as it shows just one picture)
User avatar
forum_adm
Site Admin
Posts: 1814
Joined: Fri Dec 23, 2016 9:41 am
Location: Germany
Country: Germany
Contact:

Re: [Solved] Disable embedded thumbnails on lossless jpeg rotation

Post by forum_adm »

Yes, that can be added.
Post Reply