mienaiyami / yomikiru

An offline desktop reader for manga, comics, and novels. Offers a customizable reading experience with extensive settings, shortcuts, themes and layouts. Manga reader / Manhwa reader / Webtoon Reader / EPUB Reader. **Not a downloader**
MIT License
223 stars 10 forks source link

image scaling filters #245

Open Kaito0 opened 9 months ago

Kaito0 commented 9 months ago

I like the reader! However, adding an option for various scaling algs would benefit user experience, i.e lanczos, sinc, mitchel etc. Yomikiru has a Bilinear scaling, which produces softer than desired look in =< 1080p configurations (a single image fit to width)/ except for vertical 1080p. Thanks!

omodia commented 9 months ago

For reference. Except for text in some algorithms, images do not look good in all algorithms.

mienaiyami commented 9 months ago

For reference. Except for text in some algorithms, images do not look good in all algorithms.

They didn’t mean it that way.

I have wanted to do this for a long time, hence I kept the “canvas-based renderer” around even after the scrolling issue was fixed. It just had a lower priority on my list.

mienaiyami commented 9 months ago

Also, with "canvas-based renderer" off, it uses native image element to display images for performance and low RAM usage. This feature will likely depend on "canvas-based renderer" so you can expect a lot higher RAM usage.

omodia commented 9 months ago

Also, with "canvas-based renderer" off, it uses native image element to display images for performance and low RAM usage.

You mean, it displays the original image, when canvas-based renderer is off, right?

Kaito0 commented 9 months ago

example -- 1280 x 1024 screen and hq source, canvas renderer disabled yomikiru https://drive.filen.io/d/1f5db3c5-9528-48ef-92c4-6f64a7b16c29#6ydq2agSs94fpZd1mxQF8BM1wjjVQ32r other reader app https://drive.filen.io/d/6a7199a6-002b-4550-8d4e-82eafd568df9#mGccN0CnIXcZvsOP7Fm88OB9xELTqgwW

Kaito0 commented 9 months ago

With canvas on image is sharp, but not ideal (visible patterns) - it's close to what Nearest-neighbor filter would do ~ Example with canvas on -- 1280 x 1024, hq source yomikiru https://drive.filen.io/d/0dfed07f-118d-4d14-b84c-f2154e9ece97#hbNNK58NvtrpiSm4AEjarMXuCk8M7qYV (notice artifacts -- woman's hair, cell like patterns on the table and so on) lanczos filter https://drive.filen.io/d/ed67b1f7-3e3a-4fc2-80da-ccecd41d75e9#seX7lfnaDpcNqy1nvIRwyhm1tASRRPpE

omodia commented 9 months ago

example -- 1280 x 1024 screen and hq source, canvas renderer disabled yomikiru https://drive.filen.io/d/1f5db3c5-9528-48ef-92c4-6f64a7b16c29#6ydq2agSs94fpZd1mxQF8BM1wjjVQ32r other reader app https://drive.filen.io/d/6a7199a6-002b-4550-8d4e-82eafd568df9#mGccN0CnIXcZvsOP7Fm88OB9xELTqgwW

1

Kaito0 commented 9 months ago

obviously yes it would provide identical to source result in 1:1 mode, as it dosn't scale image to screen size. 1.1 mode is unusable for 1080p or less, due to a simple fact that image is generally too big to fit. So there is downscaling for that. You would also benefit from filtering (and scaling/fitting) when you upscale 1080p image to a larger screen resolution like 4k or 5k, otherwise your image will be too small :)

omodia commented 9 months ago

This feature will likely depend on "canvas-based renderer" so you can expect a lot higher RAM usage.

They will be useful for upscaling and also depended on canvas, so it would not affect ram without enabling it.

mienaiyami commented 8 months ago

If possible, can you provide more info on this? I'm having hard time understanding many things because I'm not familiar with this like

There were more questions but i cant remember them for now, so I will ask multiple times.

Akkusativ31 commented 8 months ago

I dont know the details of how it can be implemented, but people including me just want the resizing algorhitm to be changeable from Bilinear to lancroz which the benefits of can be seen above. CDisplayEx has this feature and adding it to yomikiru would make this program perfect, thanks for your work.

mienaiyami commented 3 months ago

Normal users ignore this comment.

Owyn commented 3 months ago

+1

Biliniar doesn't seem a good choice anyway, even in that wiki link - Bicubic seems much better (and it's usually chosen as a default medium quality option everywhere) image

but a killer-feature would be to have an option to use https://github.com/nagadomi/waifu2x upscaling

cuz sadly even now in 2024 there are tons of places where comic images are provided in downscaled as heck format

mienaiyami commented 3 months ago

Its actually not bilinear for every image. Because of internal optimizations, when "upscaling" ie size of image displaying is larger than original resolution, it will use linear interpolation. But when downscaling it uses lanczos3.

As I have said above, Yomikiru dont handle image rendering by default because it can be complex in resource management (which you can already notice in "canvas based rendering", it uses a lot higher amount of RAM and CPU).

Resampling images is very expensive task and takes lot of RAM and CPU time. Even with "Magic Kernel Sharp", which is faster than lanczos3, it takes too long to load the images. Im still working on the solution to load without big initial loading time, will be releasing this as experimental feature when that is done atleast.

In case of CDisplayEx, I think it only shows one or two image at a time, thats how its able display manga fast. Even when resizing, you can notice a big delay before image resolution (not size) updates.


And as I have already mention in #289, its not possible to use waifu2x (+ it takes significantly longer to resample).