diff --git a/coders/svg.c b/coders/svg.c
index 9d72fbb..c505ee8 100644
--- a/coders/svg.c
+++ b/coders/svg.c
@@ -2166,7 +2166,9 @@
{
double
sx,
- sy;
+ sy,
+ tx,
+ ty;
if ((svg_info->view_box.width == 0.0) ||
(svg_info->view_box.height == 0.0))
@@ -2177,8 +2179,12 @@
(double) svg_info->width,(double) svg_info->height);
sx=(double) svg_info->width/svg_info->view_box.width;
sy=(double) svg_info->height/svg_info->view_box.height;
- (void) FormatLocaleFile(svg_info->file,"affine %g 0 0 %g 0.0 0.0\n",
- sx,sy);
+ tx=svg_info->view_box.x != 0.0 ? (double) -sx*svg_info->view_box.x :
+ 0.0;
+ ty=svg_info->view_box.y != 0.0 ? (double) -sy*svg_info->view_box.y :
+ 0.0;
+ (void) FormatLocaleFile(svg_info->file,"affine %g 0 0 %g %g %g\n",
+ sx,sy,tx,ty);
}
}
(void) LogMagickEvent(CoderEvent,GetMagickModule()," )");