Created attachment 111286 [details] Okular blurry images When opening epub files, without exception, the images appear blurry even if displayed at 100%. However, if I open the file with a image viewer such as mcomix or convert it to pdf with ebook-convert, the image displays normally without distortion.
Created attachment 111287 [details] Same image opened im Mcomix
The file that reproduces the issue is available at https://nofile.io/f/wx5M48ugyO9/10.1007_978-1-4302-6653-2.epub. I can't attach it here because it's slightly too large for the 4MB file size limit.
Git commit 57be655c15e2a9349e0f1dd5c9d083675c85a7f4 by Albert Astals Cid, on behalf of Gilbert Assaf. Committed on 28/07/2018 at 21:13. Pushed by aacid into branch 'Applications/18.08'. Improve picture scaling issues in epub generator Test Plan: I tested the file mentioned in the bug report. Pictures look less blurry Reviewers: #okular Subscribers: ngraham, aacid, okular-devel Tags: #okular Differential Revision: https://phabricator.kde.org/D13766 M +2 -2 generators/epub/epubdocument.cpp https://commits.kde.org/okular/57be655c15e2a9349e0f1dd5c9d083675c85a7f4
Any work left for this ticket?
Yes, the path patch improved things, but it's not 100% solved yet.
I looked into this today and I think I found the root cause of the issue. I don't know how to fix it though :/ The problem seems to be setPageSize(QSizeF(600, 800)); This has the effect that images loaded later will be scaled to fit that size. If they are smaller, they will be scaled up, if they are larger they will be scaled down. When you view a document at 100%, you're thus not viewing the image in its original size, but 100% of its scaled version. I verified this by setting the page size to what is defined in the epub itself and disabling the scaling altogether. Images were showing fine then. The problem is that there is no standard for defining the page size for an epub. In fact, the epub mentioned earlier doesn't even mention a page size. I have a Manga epub which defines the page size like this: <meta content="width=900, height=1350" name="viewport"/> (which at least seems to be some standard among art books) and the title page of a novel which looks like this: <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 592 871"> <image width="592" height="871" xlink:href="9783838717227_front.jpg"/> </svg> On top of this, different pages in the same document can have different sizes. Not really sure how to go about this :/
Same on Kubuntu 18.10
This is still an issue with Okular 22.04. Seems like an easy solution would be to just double the setPageSize to 1200, 1600. Seems to work fine here, tested on a HiDPI screen.
When I checked now with an epub of a comic I just got from Kobo, and there the png was 1400x2000. So I don't think we should just double it, we should triple the size to 1800, 2400 to be sure. Or make it configurable, of course.
This doesn't have an easy fix, unfortunately, because more often than not a page is css data, not a raw png, even if it's a comic. So I haven't found a simple method for scaling the page when it needs to expand to fill the frame in okular - I guess it needs some kind of viewport/zoom functionality on a page itself. You can't do it in image scaling alone, at least I couldn't get it to work.
I think it is the same bug. My images gets zoomed in so much that they are not shown whole and are very pixelated. This really hampers Okular to be used as an epub reader. E.g. If I have a table that I can only read half of. Here is an image of the problem https://imgur.com/a/eTxXqyE Until the bug is fixed is there a workaround to see the whole image?
yes I believe this is a good solution for now. we should add the ability to, for example double click on an image in an epub, to view it in its full original resolution. in a popup for example.
Any news about this? Not sure how I would develop a patch for this myself, one would have to get the viewport data out of the epub to then calculate the optimal viewport, and I don't think the epub library has that functionality built-in (getting the raw data in a way that is). So I don't know where I should start...