- Posts: 3354
- Thank you received: 692
Help and support for Windows users.
PDF render quality problem
- Luis Ángel
-
- Offline
- Administrator
-
Less
More
2 years 4 months ago #8514
by Luis Ángel
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\
Replied by Luis Ángel on topic PDF render quality problem
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.
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\
Please Log in or Create an account to join the conversation.
- selmf
- Offline
- Moderator
-
Less
More
- Posts: 639
- Thank you received: 136
2 years 4 months ago #8515
by selmf
My answers are not necessarily official YACReader statements but mostly represent my own opinion in technical matters.
Replied by selmf on topic PDF render quality problem
github.com/YACReader/yacreader/blob/deve...common/pdf_comic.cpp
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.
Code:
// 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.
Please Log in or Create an account to join the conversation.
- LethalWeapon
-
- Offline
- New Member
-
Less
More
- Posts: 8
- Thank you received: 1
2 years 4 months ago - 2 years 4 months ago #8516
by LethalWeapon
Replied by LethalWeapon on topic PDF render quality problem
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
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: 2 years 4 months ago by LethalWeapon.
Please Log in or Create an account to join the conversation.
- selmf
- Offline
- Moderator
-
Less
More
- Posts: 639
- Thank you received: 136
2 years 4 months ago #8527
by selmf
My answers are not necessarily official YACReader statements but mostly represent my own opinion in technical matters.
Replied by selmf on topic PDF render quality problem
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.
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.
Please Log in or Create an account to join the conversation.
- Luis Ángel
-
- Offline
- Administrator
-
Less
More
- Posts: 3354
- Thank you received: 692
2 years 4 months ago - 2 years 4 months ago #8528
by Luis Ángel
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\
Replied by Luis Ángel on topic PDF render quality problem
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: 2 years 4 months ago by Luis Ángel.
Please Log in or Create an account to join the conversation.
- selmf
- Offline
- Moderator
-
Less
More
- Posts: 639
- Thank you received: 136
2 years 4 months ago #8529
by selmf
My answers are not necessarily official YACReader statements but mostly represent my own opinion in technical matters.
Replied by selmf on topic PDF render quality problem
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.
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.
Please Log in or Create an account to join the conversation.
- inzemix
-
Topic Author
- Offline
- New Member
-
Less
More
- Posts: 14
- Thank you received: 2
2 years 4 months ago #8530
by inzemix
Replied by inzemix on topic PDF render quality problem
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
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
Please Log in or Create an account to join the conversation.
- selmf
- Offline
- Moderator
-
Less
More
- Posts: 639
- Thank you received: 136
2 years 4 months ago #8531
by selmf
My answers are not necessarily official YACReader statements but mostly represent my own opinion in technical matters.
Replied by selmf on topic PDF render quality problem
@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.
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.
Please Log in or Create an account to join the conversation.
- Luis Ángel
-
- Offline
- Administrator
-
Less
More
- Posts: 3354
- Thank you received: 692
2 years 4 months ago #8532
by Luis Ángel
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\
Replied by Luis Ángel on topic PDF render quality problem
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\
Please Log in or Create an account to join the conversation.
- inzemix
-
Topic Author
- Offline
- New Member
-
Less
More
- Posts: 14
- Thank you received: 2
2 years 4 months ago #8533
by inzemix
Replied by inzemix on topic PDF render quality problem
@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 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 😁
Please Log in or Create an account to join the conversation.
Moderators: Luis Ángel