moshensky / pdf-visual-diff

Visual Regression Testing for PDFs in JavaScript
MIT License
43 stars 18 forks source link

feat: introduces an option to disable scaling #64

Closed moshensky closed 2 months ago

moshensky commented 3 months ago

This PR introduces an option to set image scaling, which provides the benefit of significantly faster comparisons, albeit at the cost of image quality when using lower than the default DPI value, e.g. 72 instead of 144.

Solves #58

GrayedFox commented 3 months ago

As per your comment about the origin point - if the current behaviour is to define the mask in pixels (which just happens to have a 1:1 relationship to points based on the upscaling or not) and the mask is indeed applied after converting to a PNG, perhaps a low-touch approach is to:

Not entirely sure but these lines may give you trouble? I haven't used canvas however so am guessing: https://github.com/moshensky/pdf-visual-diff/blob/feat/expose-png-scaling-option/src/pdf2png.ts#L83

Cheers moit!