foliate icon indicating copy to clipboard operation
foliate copied to clipboard

Some fixed layout .mobi files not rendered correctly

Open gynamics opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe. I am using foliate-2.6.4 now, it has brought me the best ebook reading experience. Thank you for your work!

Recently I received several manguas in .mobi format, they're opened correctly on my laptop. Unluckily, I found these images are not scaled properly, in automatic mode the images are cropped, in scroll or continuous mode the images are slit. I am not familiar with document processing do not know if it is a problem with file format version or something else. Unless I have to scale it to the same height as my screen, I have no solution to view an whole image without open it in image reader independently. Whenever I want to switch to a new page, I need to close the image reader, switch to next page and click it to open it in image reader, that is not a good reading experience.

Describe the solution you'd like Is it possible to read images in .mobi as book pages with correct scaling, rotation and scrolling?

Describe alternatives you've considered Is it possible to switch images in image reader? That is also acceptable, though I may extract images from that file and read them with an image reader, it provides better experience within an integrated book.

gynamics avatar Sep 13 '22 09:09 gynamics

Can you post some screenshots, and ideally the file to reproduce the problem? Or you can try using the devtools to inspect the problem (see the wiki for how to use the inspector).

johnfactotum avatar Sep 13 '22 16:09 johnfactotum

Can you post some screenshots, and ideally the file to reproduce the problem? Or you can try using the devtools to inspect the problem (see the wiki for how to use the inspector).

One of the mangua referred can be downloaded here, I tested with several other mobi manguas, the scaling & scrolling problems still exist.

I checked the developer console and it reports this, but I guess this is not the problem.

Failed to load resource: Error opening file /usr/share/com.github.johnfactotum.Foliate/assets/epub.js.map: No such file or directory

This seems to be a packing error, the package I am using is packed by arch community.

By using the inspector I found that several style rules of this element seems not working (ashamed that I do not have a method to upload an image). But I do not know which one does matter.

gynamics avatar Sep 13 '22 16:09 gynamics

So I took a closer look at this. The problem seems to be that the book doesn't set the viewport meta tag for each page and, while there is viewport data in the file (the so-called "original-resolution" key in the EXTH header), KindleUnpack only outputs

<meta name="original-resolution" content="1072x1448" />

which is strictly for information only, and is not processed by Epub.js. Instead it should convert it into the rendition:viewport property (which I think is handled by Epub.js).

<meta property="rendition:viewport">width=1072, height=1448</meta>

Indeed, it looks like it used to do that, but for some reason it was commented out: https://github.com/kevinhendricks/KindleUnpack/blob/c8be31a196fd92803f78ad34a3f18d40319bbac5/lib/mobi_opf.py#L675-L686

johnfactotum avatar Sep 27 '22 05:09 johnfactotum

Okay, so that's a problem, but even adding the viewport property, Epub.js still doesn't display it properly. Something else is going on here.

johnfactotum avatar Sep 27 '22 05:09 johnfactotum

Good job, thank you for your help!

gynamics avatar Sep 27 '22 14:09 gynamics