Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 03-31-2024, 07:40 PM   #1
rcharbon
Indie author
rcharbon began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Oct 2011
Device: Kindle WiFi/iPhone
Unhappy "Fix" EXIF orientation data in Sigil

TIL that images can contain EXIF data to set orientation. The 8 EXIF orientation values are numbered 1 to 8:
1= 0 degrees: the correct orientation, no adjustment is required.
2= 0 degrees, mirrored: image has been flipped back-to-front.
3= 180 degrees: image is upside down.
4= 180 degrees, mirrored: image has been flipped back-to-front and is upside down.
5= 90 degrees: image has been flipped back-to-front and is on its side.
6= 90 degrees, mirrored: image is on its side.
7= 270 degrees: image has been flipped back-to-front and is on its far side.
8= 270 degrees, mirrored: image is on its far side.

What I also found is that almost everything uses this data to automatically correct image orientation. I'm on Win11, and File Explorer, Word, etc... all use the data to show images properly oriented, as does Sigil.

Unfortunately, the epub I'm working on has a bunch of images that have non-"1" orientation values. The images all look OK as the book goes through Sigil, but when I view the book in (for example) Adobe Digital Editions, ADE ignores the orientation data and pictures show up turned in all directions. More critically, KDP also ignores orientation data.

Of course, since Sigil DOES adjust for orientation, there's no easy way to see which images need to be fixed.

So:
-Any ideas to help solve the immediate problem?
-Sigil Feature request: add ability to disable automatic image orientation (or ability to automatiaclly output reoriented images)
rcharbon is offline   Reply With Quote
Old 03-31-2024, 08:47 PM   #2
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,638
Karma: 5433388
Join Date: Nov 2009
Device: many
Sigil does no image editing or orientation at all. It just loads image data provided by the file. You can use "open with" in Sigil to launch your image editor of your choice. Use that image editor to orient the image the way you want and save it replacing the old image.

Last edited by KevinH; 03-31-2024 at 08:57 PM.
KevinH is online now   Reply With Quote
Advert
Old 03-31-2024, 08:56 PM   #3
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,638
Karma: 5433388
Join Date: Nov 2009
Device: many
Sounds like a bug in the Adobe Digital Edition E-reading software? Are you using the very latest version of ADE?

Does KDP (KindlePreview?) show the same bug?

Probably best to use a real image editing program to properly transform the image so that no rotation is needed to make those images work with the greatest number of e-readers.

Last edited by KevinH; 03-31-2024 at 09:08 PM.
KevinH is online now   Reply With Quote
Old 03-31-2024, 09:10 PM   #4
rcharbon
Indie author
rcharbon began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Oct 2011
Device: Kindle WiFi/iPhone
It is not true that Sigil doesn't apply orientation values when displaying images.
rcharbon is offline   Reply With Quote
Old 03-31-2024, 09:24 PM   #5
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,638
Karma: 5433388
Join Date: Nov 2009
Device: many
You are confusing Sigil with the QtWebEngineWidget that Sigil uses in its Preview mode. This widget is basically a wrapper around the Chrome browser engine and is not controlled by Sigil code. Since Chrome 81, recognizing EXIF data and properly orienting it is built in. You can use svg to wrap and rotate an image but Sigil itself has no way to change the QtWebEngine source code. You would have to ask Qt for a way to disable that if one exists.

As I said earlier, Sigil has no code for directly reading or manipulating image exif code. And since Sigil handles it properly, why on earth would we want a way to disable that.

Again, use a third party image editor that can properly transform the image and then remove the exif data if needed. ImageMagick may help.

I believe there are css rotate transforms you may be able to apply but they would need to be restricted to work for ADE and KDP. Your best bet is probably to strip the exif, and transform (rotate) the image.

Last edited by KevinH; 04-01-2024 at 10:30 AM.
KevinH is online now   Reply With Quote
Advert
Old 03-31-2024, 09:48 PM   #6
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,638
Karma: 5433388
Join Date: Nov 2009
Device: many
And a quick google search will point you to a number of image exif removal or editing tools. You could try bulk removing all the exif data and then loading them in Sigil or any browser to detect which need to be rotated or to dump the exif rotation data by file name.
KevinH is online now   Reply With Quote
Old 03-31-2024, 10:47 PM   #7
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,561
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by KevinH View Post
. . .
You could try bulk removing all the exif data and then loading them in Sigil or any browser to detect which need to be rotated or to dump the exif rotation data by file name.
I've used this for well over a decade ==>> https://www.digitalconfidence.com/BatchPurifier.html

There's a Free LITE version for JPEGs ==>> https://www.digitalconfidence.com/downloads.html

BR
BetterRed is offline   Reply With Quote
Old 04-01-2024, 05:39 AM   #8
rcharbon
Indie author
rcharbon began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Oct 2011
Device: Kindle WiFi/iPhone
The distinction between "Sigil" and "code inlcuded in Sigil that Sigil uses" is a fine one from the user's point of view. But given the widget use, adding something to warn about non-1 orientations seems non trivial.

I guess batch stripping the EXIF data is something I'll have to start doing. Doesn't help with the current project tho
rcharbon is offline   Reply With Quote
Old 04-01-2024, 08:09 AM   #9
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,638
Karma: 5433388
Join Date: Nov 2009
Device: many
You can batch strip at any time. Just unzip the epub or use Sigil's Folder Out plugin, run the exif stripper on all of the files in the image folder. Use Sigil's FolderIn plugin to read it back in.

Or just use ImageMagick to batch "auto rotate" the images based on their current exif values and saving them after stripping the exif.

Tools like that exist for just that reason.

Last edited by KevinH; 04-01-2024 at 08:35 AM.
KevinH is online now   Reply With Quote
Old 04-01-2024, 08:13 AM   #10
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,638
Karma: 5433388
Join Date: Nov 2009
Device: many
Quote:
Originally Posted by rcharbon View Post
The distinction between "Sigil" and "code inlcuded in Sigil that Sigil uses" is a fine one from the user's point of view. But given the widget use, adding something to warn about non-1 orientations seems non trivial.

I guess batch stripping the EXIF data is something I'll have to start doing. Doesn't help with the current project tho
No that distinction exists for every dll library, every glibc version, every os system gui widget, etc. I can not change other people's code. So when one of the developers of Sigil says Sigil has no code to do that, perhaps you might actually believe him.

Or just use github to search for "exif" in the entire Sigil codebase. Hint: You will not find it.

Last edited by KevinH; 04-01-2024 at 10:31 AM.
KevinH is online now   Reply With Quote
Old 04-01-2024, 11:23 AM   #11
rcharbon
Indie author
rcharbon began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Oct 2011
Device: Kindle WiFi/iPhone
And no, Kindle Previewer does not use the Orientation information.
rcharbon is offline   Reply With Quote
Old 04-01-2024, 11:46 AM   #12
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,638
Karma: 5433388
Join Date: Nov 2009
Device: many
That was generally true for all img tags for images loaded via its src attribute as that was the spec (to ignore exif and not post process it). At some point around Chrome version 81 (and earlier for Safari, not sure about Firefox) that changed. So any ebook e-reading sdk based on an earlier spec engine, would ignore the exif.

So cleaning up the image files and removing the exif first is the best approach to make an epub that is compatible with the most e-readers.
KevinH is online now   Reply With Quote
Old 04-02-2024, 05:35 AM   #13
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 692
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
This problem does indeed exist, although I have never encountered it. Probably because I always optimize and minimize the images I include in the EPUB file, so removing the EXIF data is somehow mandatory.

However, since the problem exists I have tried to find a solution for those who need it.
The plugin detects if any of the JPG images do not have an 'Orientation' tag with a value other than 1 and displays a corresponding report in the 'Validation Results' window.

Hint 1:
The JPEGOptimizer plugin prepared by Doitsu takes the orientation information into account.

Hint 2:
The jpegoptim program used by the JPEGOptimizer plugin has the ability to remove EXIF.
Spoiler:
Code:
-s, --strip-all   strip all markers from output file
--strip-none      do not strip any markers
--strip-com       strip Comment markers from output file
--strip-exif      strip Exif markers from output file
--strip-iptc      strip IPTC/Photoshop (APP13) markers from output file
--strip-icc       strip ICC profile markers from output file
--strip-xmp       strip XMP markers markers from output file



In the attachments:
  • a screenshot from ADE 4.5
  • a sample EPUB file
  • a view of the Sigil window after launching the plugin
  • the CheckImageOrientation plugin
Attached Thumbnails
Click image for larger version

Name:	ade45-sample.png
Views:	25
Size:	84.6 KB
ID:	207299   Click image for larger version

Name:	sigil-results.png
Views:	26
Size:	146.0 KB
ID:	207301  
Attached Files
File Type: epub orientation.epub (62.9 KB, 19 views)
File Type: zip CheckImageOrientation_v0.0.4.zip (4.3 KB, 37 views)

Last edited by BeckyEbook; 04-02-2024 at 06:22 AM.
BeckyEbook is offline   Reply With Quote
Old 04-02-2024, 09:46 AM   #14
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,638
Karma: 5433388
Join Date: Nov 2009
Device: many
Nicely done! May I add this to the Sigil Plugin Index?
KevinH is online now   Reply With Quote
Old 04-02-2024, 10:06 AM   #15
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 692
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
Sure, although it's a very niche plugin, so I'm unlikely to create a separate thread for it.
BeckyEbook is offline   Reply With Quote
Reply

Tags
exif, image orientation

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
On manually creating /data/ folder vs using "Add data files to selected book records" droopy Library Management 1 07-31-2023 09:29 PM
Sigil "1.9.20" on "Qt 5.12.9" crashing on "Windows 10" AntoniDol Sigil 40 02-15-2023 09:44 AM
How to fix "Extra Titles" in Database in " Check Library - Problems Found millan Library Management 33 07-16-2015 07:12 AM
Touch How transfer "Books Read" and "Hours Read" data Abrakadabra77 Kobo Reader 5 02-16-2015 03:30 AM
No data in "In Library" and "On Device" columns after upgrade ily426 Library Management 8 04-03-2011 02:53 PM


All times are GMT -4. The time now is 03:32 PM.


MobileRead.com is a privately owned, operated and funded community.