sumatrapdfreader / sumatrapdf

SumatraPDF reader
http://www.sumatrapdfreader.org
GNU General Public License v3.0
13.33k stars 1.69k forks source link

Disable/Enable image filtering #2792

Open Shideravan opened 2 years ago

Shideravan commented 2 years ago

Sumatra does filter .CBX files but doesn't filter .PDf files. Would be nice if such feature can be set by the user freely. image

GitHubRulesOK commented 2 years ago

have enough complaint about not keeping vectors sharp as specified in PDF dictionary, PDF should be pixel perfect for print single pixels unless fuzzy text is needed by antialiasing those step changes for fuzzy images use jpg like more photographic and thats generally the mode for manga / comics

You Know you can save as the images to PDF if you want the sharper more accurate blocky graphics image

curiosport commented 8 months ago

@GitHubRulesOK What is the name of the filter they apply to images in manga mode?

GitHubRulesOK commented 8 months ago

@curiosport "Manga" screen layout mode is simply use LTR or RTL (perhaps should be called "L2R2R2L") all it does is alter the page order from 1234 to 2143 or combined with "book mode" 13254

Most images outside PDF are "Anti-Aliased" to reduce harsh edges pixels in PDF image same image as lossless PNG image

curiosport commented 8 months ago

Oh sorry, I didn't explain myself, I want to know the name of the algorithm they use for image filtering when opening a folder of images in Sumatra, "Anti-Aliased" or whatever they do, please give me the name.

Like the one on the left: image

GitHubRulesOK commented 8 months ago

I dont know the formula at single pixel level as shown above see the pure screen values as 3x3 pixels unchanged in a pdf, that is from MuPDF rendering engine it seems to be skewed off centre by a half pixel and the median values are spread almost evenly ? each pixel will progressively take a mix of the colors in a block around it

curiosport commented 8 months ago

@GitHubRulesOK Does the filter application come from mupdf? So when I open a folder of images, Sumatra first converts it to PDF and then shows it on the screen?

GitHubRulesOK commented 8 months ago

No other way round PDF (unitless) is converted to pixels at higher density so 1 pixel may easily become 300 pure pixels as shown above So not same for PNG pixels to PDF otherwise it would become blurred before conversion the first case is PNG to PDF eash pixel is kept square (but in PDF it can be any shape such as rectangle oval honeycomb etc, the convention is simply use XxY scalar with or without an x and or Y skew)

CBX like the lower image those single png pixels have been averaged from centres for say the 300 pixels spread at zoom JPG can be worse as the colours get artificially skewed in variable blocks due to colour removal (lower quality but at 100% it should look same as PNG).

GitHubRulesOK commented 8 months ago

Perhaps this shows the differences better PDF with Javascript sourced image. PDF uses binary numerics for monochrome as required for Barcode images etc so natively it is lossless no anti alias to distort.

Middle image is identical (extracted from image on the left, but rendered as a PNG Right hand image is after same MONO PNG is saved as Multicolour JPG the quality loss is as applied by Microsoft defaults

image

Similar quality to an image viewer, except the image viewer uses double the density so looks better at that same scale image