Convert SVG -density not working!

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
nycionx
Posts: 14
Joined: 2015-11-21T19:20:50-07:00
Authentication code: 1151

Convert SVG -density not working!

Post by nycionx »

As in a previous post i mentioned:
I just installed the latest version of ImageMagick-6.9.2-6 from source on Linux Mint 17.2 x64 in a separate location btw (/home/im/).

I'm getting a new problem running this command with convert:

./convert sample.svg -density 180 -background none -trim sample.png

the output png file is small like 200x200. it hasnt changed in size at all!

i googled around before posting again. some ppl said i have to install rsvg which i then did and it appears in my DELEGATES but after rebuilding ImageMagick the command still doenst work as it should. it used to work once like a year ago when i was playing with this software but now it wont. why?


nycionx@nycionx-VirtualBox /home/im/bin $ ./convert -list configure
Path: /home/im/lib/ImageMagick-6.9.2//config-Q16/configure.xml

Name Value
-------------------------------------------------------------------------------
CC gcc -std=gnu99 -std=gnu99
CFLAGS -I/usr/include/libxml2 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -pthread -I/usr/include/librsvg-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairo -I/usr/include/libpng12 -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -pthread -I/usr/include/OpenEXR -I/usr/include/lqr-1 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/graphviz -I/usr/include/freetype2 -I/usr/include/freetype2 -pthread -fopenmp -g -O2 -Wall -mtune=core-avx-i -fexceptions -pthread -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
CODER_PATH /home/im/lib/ImageMagick-6.9.2/modules-Q16/coders
CONFIGURE ./configure '--prefix=/home/im' '--exec-prefix=/home/im' '--datadir=/home/im' '--with-png=yes' '--with-gslib=yes' '--with-rsvg=yes'
CONFIGURE_PATH /home/im/etc/ImageMagick-6/
COPYRIGHT Copyright (C) 1999-2015 ImageMagick Studio LLC
CPPFLAGS -I/home/im/include/ImageMagick-6
CXX g++
CXXFLAGS -g -O2 -pthread
DEFS -DHAVE_CONFIG_H
DELEGATES bzlib djvu mpeg fontconfig freetype gslib jbig jng jpeg lcms lqr lzma openexr png ps rsvg tiff wmf x xml zlib
DISTCHECK_CONFIG_FLAGS --disable-deprecated --with-quantum-depth=16 --with-jemalloc=no --with-umem=no --with-autotrace=no --with-fontpath= --with-perl=no
DOCUMENTATION_PATH /home/im/doc/ImageMagick-6
EXEC-PREFIX /home/im
EXECUTABLE_PATH /home/im/bin
FEATURES DPC Cipher OpenMP
FILTER_PATH /home/im/lib/ImageMagick-6.9.2/modules-Q16/filters
GIT_REVISION 10342
HOST x86_64-unknown-linux-gnu
INCLUDE_PATH /home/im/include/ImageMagick-6
LDFLAGS -L/home/im/lib
LIB_VERSION 0x692
LIB_VERSION_NUMBER 6,9,2,6
LIBRARY_PATH /home/im/lib/ImageMagick-6.9.2
LIBS -ljbig -llcms2 -ltiff -lfreetype -ljpeg -lgs -llqr-1 -lglib-2.0 -lpng12 -ldjvulibre -lfontconfig -lfreetype -lwmflite -lXext -lXt -lSM -lICE -lX11 -llzma -lbz2 -pthread -lIlmImf -lz -lImath -lHalf -lIex -lIlmThread -lrsvg-2 -lm -lgio-2.0 -lgdk_pixbuf-2.0 -lcairo -lgobject-2.0 -lglib-2.0 -lxml2 -lgvc -lcgraph -lcdt -lz -lm -lgomp
NAME ImageMagick
PCFLAGS -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
PREFIX /home/im
QuantumDepth 16
RELEASE_DATE 2015-11-22
SHARE_PATH /home/im/ImageMagick-6
SHAREARCH_PATH /home/im/lib/ImageMagick-6.9.2/config-Q16
TARGET_CPU x86_64
TARGET_OS linux-gnu
TARGET_VENDOR unknown
VERSION 6.9.2
WEBSITE http://www.imagemagick.org

Path: [built-in]

Name Value
-------------------------------------------------------------------------------
FEATURES OpenMP
NAME ImageMagick
QuantumDepth 16
nycionx
Posts: 14
Joined: 2015-11-21T19:20:50-07:00
Authentication code: 1151

Re: Convert SVG -density not working!

Post by nycionx »

btw if i try to use the same command on my server at hostgator it works! so i check their stats (see below)

first they dont even have RSVG listed in their DELEGATES and second their SVG says Scalable Vector Graphics (XML 2.7.6). XML not RSVG like with mine!: should this matter? just something i noted.. please help me figure this out thx! and yes ive also tried to build their version of ImageMagick (6.7.6) but that also doesnt work.

MY STATS:
convert -list format | grep SVG
MSVG SVG rw+ ImageMagick's own SVG internal renderer
SVG SVG rw+ Scalable Vector Graphics (RSVG 2.40.1)
SVGZ SVG rw+ Compressed Scalable Vector Graphics (RSVG 2.40.1)


STATS ON HOSTGATOR SERVER:

convert -list format | grep SVG
MSVG SVG rw+ ImageMagick's own SVG internal renderer
SVG SVG rw+ Scalable Vector Graphics (XML 2.7.6)
SVGZ SVG rw+ Compressed Scalable Vector Graphics (XML 2.7.6)



convert -list configure

Path: /usr/lib64/ImageMagick-6.7.6/config/configure.xml

Name Value
-------------------------------------------------------------------------------
CC gcc -std=gnu99 -std=gnu99
CFLAGS -O2 -g -Wall
CODER_PATH /usr/lib64/ImageMagick-6.7.6/modules-Q16/coders
CONFIGURE ./configure '--host=x86_64-unknown-linux-gnu' '--build=x86_64-unknown-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-shared' '--disable-static' '--with-modules' '--with-perl' '--with-x' '--with-magick_plus_plus' '--with-gslib' '--with-wmf' '--with-lcms' '--without-rsvg' '--without-threads' '--with-xml' '--with-perl-options=INSTALLDIRS=vendor' '--without-dps' '--without-included-ltdl' '--with-ltdl-include=/usr/include' '--with-ltdl-lib=/usr/lib64' 'build_alias=x86_64-unknown-linux-gnu' 'host_alias=x86_64-unknown-linux-gnu' 'CFLAGS=-O2 -g' 'CXXFLAGS=-O2 -g'
CONFIGURE_PATH /etc/ImageMagick/
COPYRIGHT Copyright (C) 1999-2012 ImageMagick Studio LLC
CPPFLAGS -I/usr/include/ImageMagick
CXX g++
CXXFLAGS -O2 -g
DEFS -DHAVE_CONFIG_H
DELEGATES bzlib fontconfig freetype gs jpeg jng jp2 lcms openexr pango png tiff x11 xml wmf zlib
DISTCHECK_CONFIG_FLAGS 'CFLAGS=-O2 -g' --disable-deprecated --with-quantum-depth=16 --with-umem=no --with-autotrace=no --with-dps=no --with-fontpath= --with-rsvg=no
DOCUMENTATION_PATH /usr/share/doc/ImageMagick-6.7.6
EXEC-PREFIX /usr
EXECUTABLE_PATH /usr/bin
FEATURES
FILTER_PATH /usr/lib64/ImageMagick-6.7.6/modules-Q16/filters
HOST x86_64-unknown-linux-gnu
INCLUDE_PATH /usr/include/ImageMagick
LDFLAGS -L/usr/lib64 -L/usr/lib
LIB_VERSION 0x676
LIB_VERSION_NUMBER 6,7,6,8
LIBRARY_PATH /usr/lib64/ImageMagick-6.7.6
LIBS -lMagickCore -llcms -ltiff -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lm -lgomp -lltdl
NAME ImageMagick
PCFLAGS
PREFIX /usr
QuantumDepth 16
RELEASE_DATE 2012-05-02
SHARE_PATH /usr/share/ImageMagick-6.7.6
SVN_REVISION 7710
TARGET_CPU x86_64
TARGET_OS linux-gnu
TARGET_VENDOR unknown
VERSION 6.7.6
WEBSITE http://www.imagemagick.org

Path: [built-in]

Name Value
-------------------------------------------------------------------------------
NAME ImageMagick
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert SVG -density not working!

Post by snibgo »

You don't say what the command is doing wrong. But it might be corrected by putting "-density 180" before the input file, not after it.
snibgo's IM pages: im.snibgo.com
nycionx
Posts: 14
Joined: 2015-11-21T19:20:50-07:00
Authentication code: 1151

Re: Convert SVG -density not working!

Post by nycionx »

ur right this:

./convert -density 180 sample.svg -background none -trim sample.png

makes it bigger which is good but it doesnt do the other parts -trim and -background none, how can i achieve this?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert SVG -density not working!

Post by fmw42 »

Perhaps it would be better if you posted your image (to some place such as dropbox.com) and put the URL here, so we can see what you are trying to do. -trim will trim any constant area at the sides of the image. If it is not constant, then you need to use -fuzz XX% to get nearby colors. -background none, does nothing here. If you want to make some image colors into transparent, then use -fuzz XX% -fill somecolor -transparent. Also you should add +repage afte the -trim.
nycionx
Posts: 14
Joined: 2015-11-21T19:20:50-07:00
Authentication code: 1151

Re: Convert SVG -density not working!

Post by nycionx »

ok here is the svg file: https://www.dropbox.com/s/tmk80f5ci7gyv ... e.svg?dl=0

btw i wanted to point out that putting -density before the svg filename DOES make the png bigger but i noticed its also blurry the Z!
also this command: ./convert sample.svg -density 180 -background none -trim sample.png
works exactly how i want it to but only on my hostgator server as mentioned above...so... i dont really get wuts going on??
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert SVG -density not working!

Post by fmw42 »

This command works fine for me on IM 6.9.2.6 Q16 Mac OSX

Code: Select all

convert -density 180 -background none sample.svg -trim +repage sample.png
Adjust the density as you might desire for the output size.

Your issue is likely due to either different SVG delegate libraries or versions on your two systems. You should choose inkscape, RSVG or MSVG in that order. I have RSVG 2.40.2 on my system. MSVG (XML) is the IM internal SVG reader and the lease capable and perhaps IM version dependent. You can see what you have, if you are on a recent version of IM by using

Code: Select all

convert -list format
SVG SVG rw+ Scalable Vector Graphics (RSVG 2.40.2)

and see what is in the line for SVG

Also check your delegates from

Code: Select all

convert -version
Version: ImageMagick 6.9.2-6 Q16 x86_64 2015-11-14 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules
Delegates (built-in): bzlib cairo fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms lqr ltdl lzma openexr png ps rsvg tiff webp x xml zlib
nycionx
Posts: 14
Joined: 2015-11-21T19:20:50-07:00
Authentication code: 1151

Re: Convert SVG -density not working!

Post by nycionx »

i just tried your command and it still doesnt trim it and is still blurry..
i already listed all my details (delgates, versions,etc) in the first post above in case u didnt see. says everything. and i have RSVG 2.40.1 and same imagemagick version as u...
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert SVG -density not working!

Post by fmw42 »

This is what I get:

Code: Select all

convert -density 180 -background none sample.svg -trim +repage sample.png
Image

Is that correct or same as you get?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert SVG -density not working!

Post by fmw42 »

Does disabling OpenMP help? Mine is currently disabled.
nycionx
Posts: 14
Joined: 2015-11-21T19:20:50-07:00
Authentication code: 1151

Re: Convert SVG -density not working!

Post by nycionx »

thats exactly what i want but im not getting that all! i have no clue why?
i dunno whats OpenMP nor wut i does. im on Linux Mint 17.2 64 bit btw as stated earlier.

am i missing some other delegates or something? shouldnt i only need RSVG and PNG which i do already have? i cant figure out the problem here
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert SVG -density not working!

Post by fmw42 »

What do you get from

Code: Select all

convert -version
Is it possible you have more than one IM version on your system and are using some other version rather than 6.9.2.6?

What do you get from typing in a terminal window:

Code: Select all

type -a convert
or
which -a convert

What version of libpng?

Code: Select all

convert -list format
PNG* PNG rw- Portable Network Graphics (libpng 1.6.12)
nycionx
Posts: 14
Joined: 2015-11-21T19:20:50-07:00
Authentication code: 1151

Re: Convert SVG -density not working!

Post by nycionx »

ok i finally got ur command to work! after trying to rebuild several times. i have no idea wut was special this time but it worked :)
thx for ur help!! :)
Post Reply