Opened 14 years ago

Closed 14 years ago

#288 closed enhancement/feature request (fixed)

Support use of rsvg-convert to create pre-scaled icons

Reported by: Gerritv Owned by: KaZeR
Priority: major Milestone: version 0.2.0
Component: tools Version: git master
Severity: Keywords:


On many development platforms (Ubuntu, Scratchbox, etc) ksvg2png does not exist. To add it requires installing KDE which is generally a 130mb exercise. A simpler solution is to use rsvg-convert, which installs from librsvg2. Patching navit/xpm/navit_svg2png with the below switches it to use rsvg-convert.

Index: navit_svg2png =================================================================== --- navit_svg2png (revision 2001) +++ navit_svg2png (working copy) @@ -29,11 +29,14 @@


h=$(grep 'height="[0-9pxt.]*"' $svg.svg | head -n 1 | sed -e 's/.*height="' -e 's/[pxt]*".*')


  • ksvgtopng $w $h $svg.svg $png

+ rsvg-convert -w $w -h $h $svg.svg -o $png

elif [ -f $svg.svgz ] then

gzip -dc <$svg.svgz >$svg.svg

  • ksvgtopng $w $h $svg.svg $png

+ rsvg-convert -w $w -h $h $svg.svg -o $png

rm -f $svg.svg



Change History (4)

comment:1 Changed 14 years ago by KaZeR

  • Resolution set to fixed
  • Status changed from new to closed

Ticket has been solved in rev 2002, in a slightly different way : navit-svg2png will now use either ksvntopng, rsvg-convert, or inkscape according to which one is available. Thanks for your patch!

comment:2 Changed 14 years ago by

  • Component changed from core to tools
  • Resolution fixed deleted
  • Status changed from closed to reopened


I'd like to request a priority change of the svg-conversion tools used.

As described here , I hit a bug crashing my computer using ksvgtopng. Also, I would suggest preferring ksvgtopng4 over ksvgtopng.

This is the patch I propose:

diff -Naur navit-0.1.0+svnrev2085-r1/navit/ navit-0.1.0+svnrev2085-r2/navit/ --- navit-0.1.0+svnrev2085-r1/navit/ 2009-03-08 13:35:14.000000000 +0100 +++ navit-0.1.0+svnrev2085-r2/navit/ 2009-03-08 18:12:55.000000000 +0100 @@ -572,7 +572,7 @@

AC_ARG_ENABLE(svg2png-scaling-flag, [ --enable-svg2png-scaling-flag enable conversion of flag svgs to pngs with specified sizes], SVG2PNG_SCALES_FLAG=$enableval, SVG2PNG_SCALES_FLAG="") AC_ARG_ENABLE(svg2png-scaling-nav, [ --enable-svg2png-scaling-nav enable conversion of nav svgs to pngs with specified sizes], SVG2PNG_SCALES_NAV=$enableval, SVG2PNG_SCALES_NAV="") if test "x${enable_svg2png}" = "xyes" ; then

  • AC_PATH_PROGS([SVG2PNG], [ksvgtopng ksvgtopng4 rsvg-convert inkscape], [none])

+ AC_PATH_PROGS([SVG2PNG], [convert rsvg-convert inkscape ksvgtopng4 ksvgtopng], [none])

if test "x${SVG2PNG}" = "xnone"; then



diff -Naur navit-0.1.0+svnrev2085-r1/navit/navit/xpm/navit_svg2png navit-0.1.0+svnrev2085-r2/navit/navit/xpm/navit_svg2png --- navit-0.1.0+svnrev2085-r1/navit/navit/xpm/navit_svg2png 2009-03-08 13:35:12.000000000 +0100 +++ navit-0.1.0+svnrev2085-r2/navit/navit/xpm/navit_svg2png 2009-03-08 18:11:23.000000000 +0100 @@ -12,6 +12,9 @@


$svgtopng --without-gui --export-width=$1 --export-height=$2 --export-png=$4 $3 ;;

+ *convert) + convert $3 -resize ${1}x${2} $4 + ;;



comment:3 Changed 14 years ago by

oh, convert is part of the imagemagick toolkit, which is installed on lots of linux machines; de-facto standard on gentoo at least.

i was able to build successfully with this patch.

comment:4 Changed 14 years ago by Singesang

  • Resolution set to fixed
  • Status changed from reopened to closed

You can use now:

  --with-svg2png-use-convert   use imagemagick's convert for png creation
  --with-svg2png-use-rsvg-convert   use librsvg's rsvg-convert for png creation
  --with-svg2png-use-inkscape   use inkscapes internal convert routines for png creation
  --with-svg2png-use-ksvgtopng4   use kde4's ksvgtopng4 for png creation
  --with-svg2png-use-ksvgtopng   use kde3's convert for png creation
Note: See TracTickets for help on using tickets.