Your comments to [Bug 408222]

David Hurka david.hurka at mailbox.org
Wed Jun 5 08:36:26 BST 2019


Hi Tobias,

On Tuesday, 4 June 2019 22:08:52 GMT Tobias Deiminger wrote:
> Hi David,
> 
> I'm writing in private to not start polluting the bug thread, and
> because what you write is interesting to me (we can switch to the
> mailing list if you want).

Switching to mailing list, probably others can provide some information where 
I am speculating, unless you can. :)

> Am 04.06.2019 22:20 schrieb David Hurka:
> > Could have these reasons:
> > a) Both have a slightly different alignment of the scanned image,
> > resulting in
> > different sampling of rendered pixels which are not exactly on image
> > pixels.
> 
> What exactly do you mean with alignment here?

Evince and Okular have to request pixmaps at some time, and have to specify 
the precise location of the pixmap. Maybe they have different approaches to 
use render_page() (or what wraps it), so the actually specified location is a 
fraction of a pixel off.

Then, render_page() would sample the scanned image at a slightly different 
offset, hitting or missing pixels differently, so the input for filtering is 
different.
 
> > b) Both have same alignment, but use different filtering. (Bilinear,
> > Bicubic,
> > Nearest Neighbour,... In fact, Okular does not use nearest neighbour,
> > causing
> > smeared edges on scans. Maybe Evince does?)
> 
> Sounds like you suspect resampling in PagePainter to cause issues.

No. (I didn’t look that much in PagePainter yet.)

> But I never see PagePainter to actually do resampling: When debugging
> [...]
> QPixmap scaledCroppedPixmap = pixmap.scaled(dScaledWidth, dScaledHeight)
> should basically be a no-op?
> 
> Or did you mean filter algorithms in poppler / Splash?

Yes, I think the difference comes from there.
Now I read on Wikipedia, that Poppler has drawing backends Cairo and Splash. 
> • Cairo does not smooth bitmap images such as scanned documents.
> • Splash: Supports minification filtering of bitmaps.
When zooming in a PDF with an image in Okular, magnification filtering becomes 
visible. Until zoom is 400% of the image’s resolution, it is bilinear or 
similar, for higher zoom it is nearest neighbour, so the pixels become visible 
(“blocky”).

So, Evince probably uses Cairo, which uses nearest neighbour in the case of 
the screenshot, and Okular probably uses Splash, which apparently does not 
only minification filtering.

At least here I’m sure:
With nearest neighbour, the glyph edges are pixel edges. But with 
magnification filtering, the pixel edges are widened to neighbouring rendered 
pixels, so the glyph edge becomes wider (smeared).

Cheers, David

> Cheers
> Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot_2019-06-05_07:29:38.png
Type: image/png
Size: 45230 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20190605/3a4a0578/attachment-0001.png>


More information about the Okular-devel mailing list