Skip to content

Commit 73349a7

Browse files
committed
Handle opacity on raster images
Fix #235.
1 parent dcfbca4 commit 73349a7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cairosvg/image.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,13 @@ def image(surface, node):
102102
surface.context.clip()
103103

104104
# Paint raster image
105+
opacity = float(node.get('opacity', 1))
105106
surface.context.save()
106107
surface.context.translate(x, y)
107108
surface.context.scale(scale_x, scale_y)
108109
surface.context.translate(translate_x, translate_y)
109110
surface.context.set_source(image_surface.pattern)
110-
surface.context.paint()
111+
surface.context.paint_with_alpha(opacity)
111112
surface.context.restore()
112113

113114

0 commit comments

Comments
 (0)