![]() |
#1 |
Indie author
![]() Posts: 11
Karma: 10
Join Date: Oct 2011
Device: Kindle WiFi/iPhone
|
![]()
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) |
![]() |
![]() |
![]() |
#2 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,437
Karma: 5702578
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. |
![]() |
![]() |
![]() |
#3 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,437
Karma: 5702578
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. |
![]() |
![]() |
![]() |
#4 |
Indie author
![]() 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.
|
![]() |
![]() |
![]() |
#5 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,437
Karma: 5702578
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. |
![]() |
![]() |
![]() |
#6 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,437
Karma: 5702578
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.
|
![]() |
![]() |
![]() |
#7 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,598
Karma: 29709834
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
There's a Free LITE version for JPEGs ==>> https://www.digitalconfidence.com/downloads.html BR |
|
![]() |
![]() |
![]() |
#8 |
Indie author
![]() 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 ![]() |
![]() |
![]() |
![]() |
#9 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,437
Karma: 5702578
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. |
![]() |
![]() |
![]() |
#10 | |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,437
Karma: 5702578
Join Date: Nov 2009
Device: many
|
Quote:
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. |
|
![]() |
![]() |
![]() |
#11 |
Indie author
![]() Posts: 11
Karma: 10
Join Date: Oct 2011
Device: Kindle WiFi/iPhone
|
And no, Kindle Previewer does not use the Orientation information.
|
![]() |
![]() |
![]() |
#12 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,437
Karma: 5702578
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. |
![]() |
![]() |
![]() |
#13 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 808
Karma: 2416112
Join Date: Jan 2017
Location: Poland
Device: Various
|
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:
In the attachments:
Last edited by BeckyEbook; 04-02-2024 at 06:22 AM. |
![]() |
![]() |
![]() |
#14 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,437
Karma: 5702578
Join Date: Nov 2009
Device: many
|
Nicely done! May I add this to the Sigil Plugin Index?
|
![]() |
![]() |
![]() |
#15 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 808
Karma: 2416112
Join Date: Jan 2017
Location: Poland
Device: Various
|
Sure, although it's a very niche plugin, so I'm unlikely to create a separate thread for it.
|
![]() |
![]() |
![]() |
Tags |
exif, image orientation |
|
![]() |
||||
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 |