Wrong size and background color since 6.8.9.7

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
jpalacios
Posts: 5
Joined: 2014-10-30T10:38:00-07:00
Authentication code: 6789

Wrong size and background color since 6.8.9.7

Post by jpalacios »

Since version 6.8.9.7 using convert with the background option set to 'none' render some svg images with a white background instead of a transparent one. It also renders the images in an incorrect size.

The following commands were used to generate the images:
convert -background none test1.svg test1.png
convert -background none test2.svg test2.png

Results:
- Attached test1.svg renders an image with wrong size and white background (see test1_FAIL.png). The size must be 100x100 and his background must be transparent.
- Attached test2.svg renders an image with wrong size and transparent background (see test2_FAIL.png). The size must be 40x40.

The attached test1_OK.png and test2_OK.png was generated using imagemagick-6.8.9.6 and shows a correct behavior.
The svg files were generated using inkscape 0.48.5.
Grab all files from here: https://dl.dropboxusercontent.com/u/669 ... les.tar.gz
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Wrong size and background color since 6.8.9.7

Post by snibgo »

For the two IM versions, try the commands with "verbose". This shows the Inkscape command. Look out for --export-background-opacity="1" or "0". It should be "0" for -background None.
snibgo's IM pages: im.snibgo.com
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Wrong size and background color since 6.8.9.7

Post by glennrp »

Results with 6.8.9-9 (using rsvg-convert) seem to be OK:
  • glenn.rp> q16convert -background none test1.svg test1_im.png
    glenn.rp> q16convert -background none test2.svg test2_im.png
    glenn.rp> pngcheck *im.png
    OK: test1_im.png (100x100, 32-bit grayscale+alpha, non-interlaced, 93.9%).
    OK: test2_im.png (40x40, 64-bit RGB+alpha, non-interlaced, 67.4%).
    No errors were detected in 2 of the 2 files tested.
    glenn.rp> q16convert | head -1
    Version: ImageMagick 6.8.9-9 Q16 x86_64 2014-10-26 http://www.imagemagick.org
Both images have transparency where it's expected.
jpalacios
Posts: 5
Joined: 2014-10-30T10:38:00-07:00
Authentication code: 6789

Re: Wrong size and background color since 6.8.9.7

Post by jpalacios »

Using verbose with both versions:
6.8.9.6

Code: Select all

convert -verbose -background none test1.svg test1.png
"inkscape" "test1.svg" --export-png="/tmp/magick-1204IZfbeBPvSulT" --export-dpi="90,90" --export-background="rgb(0%,0%,0%)" --export-background-opacity="0" > "/tmp/magick-1204okobh0rx9eOM" 2>&1
/tmp/magick-1204IZfbeBPvSulT PNG 100x100 100x100+0+0 8-bit sRGB 5.42KB 0.000u 0:00.009
test1.svg=>/tmp/magick-1204IZfbeBPvSulT SVG 100x100 100x100+0+0 8-bit sRGB 5.42KB 0.000u 0:00.000
test1.svg=>test1.png SVG 100x100 100x100+0+0 8-bit sRGB 5.57KB 0.010u 0:00.000
6.8.9.9

Code: Select all

convert -verbose -background none test1.svg test1.png
"inkscape" "test1.svg" --export-eps="/tmp/magick-1292uxKtNd5gACoK" --export-dpi="90,90" --export-background="rgb(0%,0%,0%)" --export-background-opacity="0" > "/tmp/magick-1292S8hsier5WIL1" 2>&1
/tmp/magick-1292TzkWl1BxYFkW1 PNG 83x84 83x84+0+0 8-bit sRGB 3.41KB 0.000u 0:00.000
/tmp/magick-1292uxKtNd5gACoK PNG 83x84 83x84+0+0 16-bit sRGB 3.41KB 0.000u 0:00.000
test1.svg=>/tmp/magick-1292uxKtNd5gACoK PNG 83x84 83x84+0+0 16-bit sRGB 3.41KB 0.000u 0:00.000
test1.svg=>test1.png PNG 83x84 83x84+0+0 8-bit sRGB 3.62KB 0.000u 0:00.000
[ghostscript library] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g83x84  "-sOutputFile=/tmp/magick-1292TzkWl1BxYFkW%d" "-f/tmp/magick-12928N4VAEfByutD" "-f/tmp/magick-1292PRSOIIDHdkCk"%
By the way, i forgot to write the OS name: Archlinux
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Wrong size and background color since 6.8.9.7

Post by snibgo »

The --export-background looks good. But I see that 6.8.9.9 has --export-eps instead of --export-png. Perhaps that is the problem, especially as IM needs to call Ghostscript to convert the EPS to PNG. Yeuch!
snibgo's IM pages: im.snibgo.com
jpalacios
Posts: 5
Joined: 2014-10-30T10:38:00-07:00
Authentication code: 6789

Re: Wrong size and background color since 6.8.9.7

Post by jpalacios »

Update:
In version 6.9.0.0 the size and the background of the resulting image are correct, but the layers of the svg are misaligned in the rendered png.
Convert is still using --export-eps instead of --export-png in this version.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Wrong size and background color since 6.8.9.7

Post by magick »

Grab ImageMagick-6.9.0-1 Beta. It has a SVG patch that should fix the problem you reported.
jpalacios
Posts: 5
Joined: 2014-10-30T10:38:00-07:00
Authentication code: 6789

Re: Wrong size and background color since 6.8.9.7

Post by jpalacios »

I tested it in version 6.9.0.2. Unfortunately, this bug is alive.
Convert still uses --export-eps instead of --export-png, rendering the resulting image with wrong size and background color.

Output from 6.9.0.2:

Code: Select all

convert -verbose -background "none" test1.svg test1.png                    
"inkscape" "/tmp/magick-4488r6IF_swLRpFh" --export-eps="/tmp/magick-4488wH27d8QHgzqp" --export-dpi="90,90" --export-background="rgb(0%,0%,0%)" --export-background-opacity="0" > "/tmp/magick-4488Skdc77Kc2Ibx" 2>&1
/tmp/magick-4488JUxiOO8L6u1W1 PNG 83x84 83x84+0+0 8-bit sRGB 3.29KB 0.000u 0:00.000
/tmp/magick-4488wH27d8QHgzqp PS 83x84 83x84+0+0 16-bit sRGB 3.29KB 0.000u 0:00.000
test1.svg=>/tmp/magick-4488wH27d8QHgzqp PS 83x84 83x84+0+0 16-bit sRGB 3.29KB 0.000u 0:00.000
test1.svg=>test1.png PS 83x84 83x84+0+0 8-bit sRGB 3.49KB 0.000u 0:00.000
[ghostscript library] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g83x84  "-sOutputFile=/tmp/magick-4488JUxiOO8L6u1W%d" "-f/tmp/magick-4488YnadJMlBltpO" "-f/tmp/magick-4488OPPQB4uU8rNF"%
jpalacios
Posts: 5
Joined: 2014-10-30T10:38:00-07:00
Authentication code: 6789

Re: Wrong size and background color since 6.8.9.7

Post by jpalacios »

Fixed in version 6.9.0.3
Thank you! :D

Output:

Code: Select all

convert -verbose -background "none" test1.svg test1.png
"inkscape" "/tmp/magick-59476nv1iMC6lWFi" --export-png="/tmp/magick-5947MbhGD8hgq4fy" --export-dpi="90,90" --export-background="rgb(0%,0%,0%)" --export-background-opacity="0" > "/tmp/magick-5947v0b06Ti0LcQN" 2>&1
/tmp/magick-5947MbhGD8hgq4fy PNG 100x100 100x100+0+0 8-bit sRGB 4.71KB 0.000u 0:00.000
test1.svg=>/tmp/magick-5947MbhGD8hgq4fy PNG 100x100 100x100+0+0 8-bit sRGB 4.71KB 0.000u 0:00.000
test1.svg=>test1.png PNG 100x100 100x100+0+0 8-bit sRGB 4.87KB 0.000u 0:00.000
Post Reply