3 # Convert svg file to png with a target width and height
4 # width and height are derived from the directory name
5 # of the target. Width and height must be equal
7 # Arg1: Source svg file
8 # Arg2: Filename for copyright notice
9 # Arg3: Target png file
11 # Extract the icon width from the target path e.g.
12 # src/ui/gui/icons/48x48/actions/file-save.png
13 # should result in a width of 48
14 stripprefix=${3#src*icons\/}
15 width=${stripprefix%%x*}
17 # If no width can be extracted from the destination path
18 # then take the natural width by setting width to 0
20 [0-9][0-9]|[0-9][0-9][0-9]) ;;
24 echo "Converting" $1 "to" $3 "size" $width"x"$width
28 (let* ((image (car (file-svg-load 1 \"$1\" \"$1\" 90 $width $width 0 ))))
29 (gimp-image-attach-parasite image '(\"gimp-comment\" 0 \"$comment\"))
30 (gimp-file-save 1 image (car (gimp-image-get-active-drawable image))