From 7dea7cf7a61befa83cf8eeac2e56d425d0675910 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Sat, 29 Apr 2023 13:56:34 +0200 Subject: [PATCH] Fix ratio and clip for "image" tags with no size Fix #387. --- cairosvg/image.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cairosvg/image.py b/cairosvg/image.py index e34ebe46..aa35b0c1 100644 --- a/cairosvg/image.py +++ b/cairosvg/image.py @@ -91,8 +91,10 @@ def image(surface, node): node.image_width = image_surface.get_width() node.image_height = image_surface.get_height() + width = width or node.image_width + height = height or node.image_height scale_x, scale_y, translate_x, translate_y = preserve_ratio( - surface, node) + surface, node, width, height) # Clip image region (if necessary) if not (translate_x == 0 and