X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=build-aux%2Fsvg2png;h=3ba9d6ac9ee0fb82291795e4005d2298ebe23853;hb=6d7eed1c12693a3688a3c16f634a5b816660085b;hp=3587c26167274d234076f9fc08eca3124d3ae2de;hpb=32538f9f35aee7145a49971f9dae1394a1a201b5;p=pspp diff --git a/build-aux/svg2png b/build-aux/svg2png index 3587c26167..3ba9d6ac9e 100755 --- a/build-aux/svg2png +++ b/build-aux/svg2png @@ -14,29 +14,9 @@ stripprefix=${3#src*icons\/} width=${stripprefix%%x*} -if (gimp --version) >/dev/null 2>&1; then - echo "Converting $1 to $3 size $widthx$width with GIMP" - comment=`cat $2` - # If no width can be extracted from the destination path - # then take the natural width by setting width to 0 - case "$width" in - [0-9][0-9] | [0-9][0-9][0-9]) ;; - *) width="0";; - esac - gimp -i -d -b "\ -(let* ((image (car (file-svg-load 1 \"$1\" \"$1\" 90 $width $width 0 )))) - (gimp-image-attach-parasite image '(\"gimp-comment\" 0 \"$comment\")) - (gimp-file-save 1 image (car (gimp-image-get-active-drawable image)) - \"$3\" \"$3\")) - (gimp-quit 1)" -elif (rsvg-convert --version) >/dev/null 2>&1; then - echo "Converting $1 to $3 size $widthx$width with rsvg-convert" - case $width in - [0-9][0-9] | [0-9][0-9][0-9]) widthoption="--width=$width --height=$width" ;; - *) widthoption= ;; - esac - rsvg-convert $widthoption "$1" > "$3" -else - echo "$0: can't find gimp or rsvg-convert" >&2 - exit 1 -fi +comment=`cat $2` +case $width in + [0-9][0-9] | [0-9][0-9][0-9]) widthoption="--width=$width --height=$width" ;; + *) widthoption= ;; +esac +rsvg-convert $widthoption "$1" | ${PYTHON3:-python3} build-aux/png-add-comment Comment "$comment" > "$3"