Inkscape 0.92 default density change

Announcements pertaining to ImageMagick, or ImageMagick related software. This list is moderated. No discussions here, instead post to the users group instead.
Post Reply
User avatar
fmw42
Posts: 24097
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Inkscape 0.92 default density change

Post by fmw42 » 2018-11-30T19:00:35-07:00

For those using Inkscape to render SVG files, please note that inkscape version 0.92 has recently been modified so as to work properly with a default density 96. For versions prior to 0.92, the default was 90. But when use ImageMagick to call inkscape, ImageMagick sends a density of 90 to be consistent with older versions of Inkscape. Using ImageMagick with Inkscape 0.92, if no density is defined in the SVG file will render at density 90 and the result will be too small. This can bee seen for example if one does

Code: Select all

identify svg.svg
svg.svg SVG 1076x1076 1076x1076+0+0 8-bit sRGB 40309B 0.000u 0:00.000

which is wrong whereas using the MSVG (or RSVG renderer).

Code: Select all

identify MSVG:svg.svg
MSVG:svg.svg=>svg.svg MSVG 1148x1148 1148x1148+0+0 16-bit sRGB 3811B 0.000u 0:00.000


The real issue comes when one tries to extract the clip path and use it to clip an image with Inkscape 0.92. For example from https://imagemagick.org/Usage/masking/#clip-path

Code: Select all

convert -quiet 852067A.tif[0] -alpha transparent -clip -alpha opaque -strip out.tiff
convert: image size differs `852067A.tif' @ error/image.c/SetImageClipMask/2655.


A better method is as follows (using IM 6.9.10.14)

Code: Select all

identify -quiet -format "%[8BIM:1999,2998:#1]" 852067A.tif[0]  |\
convert -quiet 852067A.tif[0] +repage \
-profile /Users/fred/images/profiles/USWebCoatedSWOP.icc \
-profile /Users/fred/images/profiles/sRGB.icc \
\( -density 96 - -negate -blur 0x1 -level 50x100% \) \
-alpha off -compose copy_opacity -composite \
-define tiff:alpha=associated \
out.tif
Note that in the above I set the density to 96 for use with my inkscape 0.92. I also include some anti-aliasing using -blur and convert the CMYK tiff file to sRGB using profiles.

Unfortunately, the above code does not work with the anti-aliasing for me on my Mac OSX Sierra with IM 7 and produces a totally transparent result. But if I remove the -blur 0x1 -level 50x100% it does work properly.

Post Reply