From 64fe910fc512f092da84833cb06453a618a9f861 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sat, 8 Jul 2017 12:31:36 +0100 Subject: [PATCH] fix DPI mixup librsvg defaulted to 90 DPI, but libvips to 72 DPI -- add a correction factor thanks Fosk! see https://github.com/jcupitt/libvips/issues/688 --- ChangeLog | 2 ++ libvips/foreign/svgload.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index b9dd1c3c..80931fd1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 12/6/17 started 8.5.7 - transform cmyk->rgb automatically on write if there's an embedded profile and the saver does not support cmyk +- fix DPI mixup in svgload ... we were writing images about 20% too large, + thanks Fosk 19/5/17 started 8.5.6 - tiff read with start page > 0 could break edge tiles or strips diff --git a/libvips/foreign/svgload.c b/libvips/foreign/svgload.c index d3afcc16..b2306d2c 100644 --- a/libvips/foreign/svgload.c +++ b/libvips/foreign/svgload.c @@ -6,6 +6,8 @@ * - add svgz support * 18/1/17 * - invalidate operation on read error + * 8/7/17 + * - fix DPI mixup, thanks Fosk */ /* @@ -115,6 +117,11 @@ vips_foreign_load_svg_build( VipsObject *object ) if( !vips_object_argument_isset( object, "scale" ) ) svg->scale = svg->dpi / 72.0; + /* librsvg defaults to 90 DPI, but vips defaults to 72. We need to + * adjust the scale down. + */ + svg->scale *= 72.0 / 90.0; + if( VIPS_OBJECT_CLASS( vips_foreign_load_svg_parent_class )-> build( object ) ) return( -1 );