[RESOLVED]possible bug using clip-paths and anti-aliasing in IM 7
Posted: 2018-11-30T19:03:55-07:00
There are two issues here.
1) The change in default density to 96 and how that is used in Inkscape 0.92 causes the rendered images from imagemagick, which sets the default to 90, to be too small and gives an error message when doing the clipping.
2) My alternate and perhaps better method works fine in IM 6, but fails in IM 7.
Here are the details:
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
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).
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
convert: image size differs `852067A.tif' @ error/image.c/SetImageClipMask/2655.
A better method is as follows (using IM 6.9.10.14)
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.
Here is the file if anyone else wants to check this out to see if the IM 7 issue is just on my Mac.
http://www.fmwconcepts.com/misc_tests/c ... 52067A.tif
1) The change in default density to 96 and how that is used in Inkscape 0.92 causes the rendered images from imagemagick, which sets the default to 90, to be too small and gives an error message when doing the clipping.
2) My alternate and perhaps better method works fine in IM 6, but fails in IM 7.
Here are the details:
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
which is wrong whereas using the MSVG (or RSVG renderer).
Code: Select all
identify MSVG:svg.svg
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
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
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.
Here is the file if anyone else wants to check this out to see if the IM 7 issue is just on my Mac.
http://www.fmwconcepts.com/misc_tests/c ... 52067A.tif