You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying to chase down a rendering quality issue with some example SVG content, where an embedded PNG would exhibit extra pixels that shouldn't be present.
I've generated a test file using the same SVG structure as that file:
where I wasn't expecting a pixel of the colour on the top/left sides of the image repeated on the bottom/right.
(resvg render to PNG then scaled 2x in feh)
I'd assumed I'd broken sampling in relation to a mipmap implementation in tiny-skia I'd added, so was surprised to find it wasn't related to that change at all. I can obviously fix this one render in resvg code, with something like:
but patterns are meant to repeat normally, so unless I disable that only for patterns-that-are-actually-images it's clearly not the right answer. The sizes aren't completely arbitrary - the issue will only occur at certain scales, suggesting a rounding/sampling issue depending on if you're lucky or not.
This graphic also fails to render in Firefox and Chromium, so is this actually a bug/feature of SVGs where the use of objectBoundingBox and width/height doesn't actually mean it'll only ever fill that space and sometimes repeated pixels will be visible?
The text was updated successfully, but these errors were encountered:
Yes, I'm seeing a similar behavior in Chrome and Safari, which suggests that it's perfectly normal.
Also, SVG isn't designed for "precise" rendering. Every library renders it in whatever way it wants.
Moreover, resvg/tiny-skia do not support fractional pattern offsets (#628), which might be one of the reasons for this behavior.
Thanks, that makes sense. I might see if there's a straightforward way to clamp the sampling for my use-case - perhaps not quite full subpixel offset handling - and otherwise encourage users not to generate graphics like this.
I've been trying to chase down a rendering quality issue with some example SVG content, where an embedded PNG would exhibit extra pixels that shouldn't be present.
I've generated a test file using the same SVG structure as that file:
where I wasn't expecting a pixel of the colour on the top/left sides of the image repeated on the bottom/right.

(resvg render to PNG then scaled 2x in feh)
I'd assumed I'd broken sampling in relation to a mipmap implementation in tiny-skia I'd added, so was surprised to find it wasn't related to that change at all. I can obviously fix this one render in resvg code, with something like:
but patterns are meant to repeat normally, so unless I disable that only for patterns-that-are-actually-images it's clearly not the right answer. The sizes aren't completely arbitrary - the issue will only occur at certain scales, suggesting a rounding/sampling issue depending on if you're lucky or not.
This graphic also fails to render in Firefox and Chromium, so is this actually a bug/feature of SVGs where the use of objectBoundingBox and width/height doesn't actually mean it'll only ever fill that space and sometimes repeated pixels will be visible?
The text was updated successfully, but these errors were encountered: