Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] Re: (PR#10734) SVG flags
Home

[Freeciv-Dev] Re: (PR#10734) SVG flags

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#10734) SVG flags
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 26 Oct 2004 14:54:39 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10734 >

Jason Short wrote:

> - Borders are still missing (although this helps in spotting the 
> "crappy" flags).

Here is a new conversion program.  This one automatically adds the black 
borders via some _very_ ugly scripting using ImageMagick.

jason

#!/bin/sh

files="$@"

# Renderer: inkscape or sodipodi.  Inkscape seems slightly better.
#SODIPODI="sodipodi"
RENDERER="inkscape"

# Target width: 28 for trident/isotrident (height is then calculated
# automatically).
TARGET_WIDTH=28

for file0 in $files; do
  filebase=`echo $file0 | sed s/.svg$//i`

  file1="$filebase-1.png"
  file2="$filebase-2.png"
  file3="$filebase-3.png"
  file4="$filebase.png"
  echo "Converting $file0 to $file1"

  # This is actually necessary for rendering
  rm -f $file1 $file2 $file3 $file4

  $RENDERER -f "$file0" -w $(($TARGET_WIDTH - 2)) -e "$file1"

  # Ugly way to determine width and height.  There must be a better way!
  SIZE=`identify "$file1" | sed "s/^.*PNG //" | sed "s/ .*\$//"`
  WIDTH=`echo $SIZE | sed "s/x.*\$//"`
  HEIGHT=`echo $SIZE | sed "s/^.*x//"`

  convert -resize $((2*$WIDTH))x$((2*$HEIGHT)) -fill black -draw "rectangle 0,0 
$((2*$WIDTH)),$((2*$HEIGHT))" $file1 $file2

  convert -crop $((2+$WIDTH))x$((2+$HEIGHT))+0x0 $file2 $file3

#  convert -draw "image under 1,1 0,0 $file1" $file3 $file4
  composite -geometry 0x0+1+1 $file1 $file3 $file4

  rm -f $file1 $file2 $file3
done

[Prev in Thread] Current Thread [Next in Thread]