Welcome to the forum, Guest

TOPIC: PDF render quality problem

PDF render quality problem 3 months 5 days ago #8514

Luis Ángel

Offline

Administrator

Posts: 2744

Thank you received: 569

Karma: 352

I need a copy of the PDF, I haven't been able to reproduce some of the reports...

PDF is rendered in different ways depending on the app and the platform, so it is hard to debug.
Contribute to the project becoming a patron: www.patreon.com/yacreader
You can also donate via Pay-Pal: www.paypal.com/donate?business=5TAMNQCDD...e=Support+YACReader\
The administrator has disabled public write access.

PDF render quality problem 3 months 5 days ago #8515

selmf

Offline

Developer

Posts: 636

Thank you received: 135

Karma: 18

github.com/YACReader/yacreader/blob/deve...common/pdf_comic.cpp
// TODO: make target DPI configurable
    QSize pagesize((FPDF_GetPageWidth(pdfpage) / 72) * 150,
                   (FPDF_GetPageHeight(pdfpage) / 72) * 150);
    // TODO: max render size too
    if (pagesize.width() > 3840 || pagesize.height() > 3840) {
        pagesize.scale(3840, 3840, Qt::KeepAspectRatio);
    }

That is for pdfium, but we use similar code for other platforms and backends. By default, PDF files report their page resolution target for a DPI of 72. Even years ago, when we last touched that code, that was was not a sane default.

So what we did was to set a default DPI of 150, which for most PDFs gives good enough results.

Even at that time it was clear that using semi-hardcoded values for the target render size and a maximum page size of 3840 could lead to issues, which is why we added the TODOs.

The most common problem is a PDF file reporting a small page size despite having high resolution images. So the pdf backend renders the page too small (downscaling) and when the result is enlarged by YACReader's viewer widget you get blurry results.

I'm about 85% certain that this is the issue, but there's also a 15% chance that this is a problem with the pdfium library we ship with the Windows builds. We haven't updated that one in ages so I wouldn't be surprised if that is the culprit.
My answers are not necessarily official YACReader statements but mostly represent my own opinion in technical matters.
The administrator has disabled public write access.

PDF render quality problem 3 months 5 days ago #8516

LethalWeapon

Offline

Fresh Boarder

Posts: 8

Thank you received: 1

Karma: 0

Hello,

Thank you for your answers, but I don't have the technical expertise to discuss them in detail. Below is a link to some files that are blurred or have excessively pronounced aliasing on the outlines.

If the defect is not very noticeable, enlarge the image to 200%.

I'm using Windows 10 Pro 1803.

I've also noticed that a number of users are simply looking for a PDF reader that allows them to adjust contrast, brightness and gamma to reduce the glare of files other than Comics (e.g. scientific studies) that are not compatible with dark mode. YACReader has these settings and they work.

In any case, I'm looking forward to an update that solves the problem, which would be a fantastic thing.

See you.

www.swisstransfer.com/d/7b8c5dc4-fa59-428e-99db-77abe7026bd4
Last Edit: 3 months 5 days ago by LethalWeapon.
The administrator has disabled public write access.

PDF render quality problem 3 months 3 days ago #8527

selmf

Offline

Developer

Posts: 636

Thank you received: 135

Karma: 18

I gave it a test on my machine and the problem was clearly visible. The default render size of these PDF is way too small.

So I set the render target to a minimum of 2560px in the source code and the problem was gone.
My answers are not necessarily official YACReader statements but mostly represent my own opinion in technical matters.
The administrator has disabled public write access.

PDF render quality problem 3 months 3 days ago #8528

Luis Ángel

Offline

Administrator

Posts: 2744

Thank you received: 569

Karma: 352

Yeah I tested them on macos with pdfkit and the same happens, maybe we should set a minimum…
Contribute to the project becoming a patron: www.patreon.com/yacreader
You can also donate via Pay-Pal: www.paypal.com/donate?business=5TAMNQCDD...e=Support+YACReader\
Last Edit: 3 months 3 days ago by Luis Ángel.
The administrator has disabled public write access.

PDF render quality problem 3 months 3 days ago #8529

selmf

Offline

Developer

Posts: 636

Thank you received: 135

Karma: 18

The ideal solution would be to know the true native resolution of the images in the pdf pages. Or to always render to the size the image we want to display has.

But having a (ideally configurable) min/max size is good enough and way easier to implement.
My answers are not necessarily official YACReader statements but mostly represent my own opinion in technical matters.
The administrator has disabled public write access.

PDF render quality problem 3 months 3 days ago #8530

inzemix

Offline

Fresh Boarder

Posts: 9

Thank you received: 2

Karma: 0

Hi selmf,

Do you have any idea how we, poor muggles can fix the problem ?
I hope there will be a fix soon, but meanwhile, is there a way to read those comics « easily » ?

Thx ;)
The administrator has disabled public write access.

PDF render quality problem 3 months 3 days ago #8531

selmf

Offline

Developer

Posts: 636

Thank you received: 135

Karma: 18

@inzemix: Tough. The current calculation is hardcoded in YACReader so you would need to change the pdf using an editor software.
You could ask the publisher for a fix or look for the source if the pdf is just an automated pdf conversion from a cbz or cbr source.
My answers are not necessarily official YACReader statements but mostly represent my own opinion in technical matters.
The administrator has disabled public write access.

PDF render quality problem 3 months 3 days ago #8532

Luis Ángel

Offline

Administrator

Posts: 2744

Thank you received: 569

Karma: 352

In cases like this PDFs don’t have any advantage over cbz/cbr, because the PDF is working as a container for a bunch of images, just like cbz/cbr files, but it adds a layer of complexity that makes hard to get the actual images, so an additional rendering pass is needed. So if a cbz/cbr version exists always use that instead of PDFs.
Contribute to the project becoming a patron: www.patreon.com/yacreader
You can also donate via Pay-Pal: www.paypal.com/donate?business=5TAMNQCDD...e=Support+YACReader\
The administrator has disabled public write access.

PDF render quality problem 3 months 3 days ago #8533

inzemix

Offline

Fresh Boarder

Posts: 9

Thank you received: 2

Karma: 0

@selmf
The pdf is the source, I won’t play with changing a cbz/cbr To a pdf (but I tried to change the pdf to a cbz using an online converter, the result was as bad as the pdf in YACReader :( )
@luis
Be sure that whenever a cbr/cbz is at my sight, I will never go for the pdf 😁 it’s so much better !

I’ll try with a pdf editor (if I find a good free one that can work in batches, I have some files which looks too bad…).

However, if you can think at a solution built in, it would be great for the future 😁
The administrator has disabled public write access.
Powered by Kunena Forum