Support floating point viewbox in resvg binary
Avoid rounding sizes for images until creating the pixmap, and always use the ceil for that to avoid truncating images. This fixes #810.
This requires a corresponding change to tiny-skia to add scale_by/scale_to_width/scale_to_height functions to tiny_skia_path::Size to match the implementations in IntSize.
This won't compile as-is, since it depends on linebender/tiny-skia#146 or a similar change.
don't want to be annoying, but - ping! I'm still waiting on this so I can stop having inkscape as a dependency in my software =w=
a-another ping 😓 sorry… impatient
What’s missing for this? Just a bump in tiny skia?
That's my understanding, yes. Once that's available then we can bump dependencies here (and consider a resvg release?).
The only question is if it's useful to have width and height directly parsed from the command line as f32 as @DJMcNab has pondered. If you used --width 33.5 --height 27.6 you'd still end up with a 34x28 PNG, but maybe with content outside of the bounding box rather than truncating it?
Thanks, will do my best to take a closer soon. Sorry for the delay.
Had to update two test cases, but only with very minimal pixel differences. I added a git dependency now because I think it'll still be a while until the next release.
I think we can merge this as is, @DJMcNab wdyt?
I'd be hesistant to land a git dependency here - I'm not sure when we would otherwise made a Tiny Skia release, so using this to force that is probably worthwhile.
@jermy, would you be willing to help here? The way to unblock a Tiny Skia release is to go through the changes since the last release, and check if any of them are breaking. At the same time, it would be great to add them to the Unreleased section of the changelog. If they aren't, we should be able to make a bump fairly easily.
Unfortunately, if there are breaking changes, the path forward is less clear.
It is a breaking change I think, because new methods were added in the PR to tiny-skia.
hey, hate to bump, but what is the course of action from here? is there any way I can help get this through faster? I would really like to have this so I can replace inkscape with resvg as my primary SVG rasterizer…
Sorry about that. :( The reason nothing is happening is basically 1) No one's really been actively developing resvg in recent months (I guess mostly because of being busy with other stuff) and 2) tiny-skia is basically unmaintained at this point (we have our own new CPU renderer that we are developing), and therefore there's little motivation to add new features and updates to the crate... So things are basically not moving at all at the moment. 😅 Hopefully this can change soon, but hard to say. :/
I'm wondering though, is that really such a critical thing to have? To me it seems like a pretty small edge case, no?
in my use-case, a lot of the images I use a rasterizer on are small enough (in SVG units) to notice discrepancies at larger scales (in pixels)
the only reason I even noticed is because it really fucked with a bunch of my images. for example:
| resvg | inkscape |
|---|---|
↑ one of the less bad examples. I don't have time to look for a worse one rn, but notice how the bottom and right sides are cut off a bit in the resvg render