Function resvg::trim_transparency
source · [−]Expand description
Removes transparent borders from the image leaving only a tight bbox content.
Detects graphics element bbox on the raster images in absolute coordinates.
The current implementation is extremely simple and fairly slow. Ideally, we should calculate the absolute bbox based on the current transform and bbox. But because of anti-aliasing, float precision and especially stroking, this can be fairly complicated and error-prone. So for now we’re using this method.