How to install inkscape in the web container


To install the cli version of inkscape in the web container to be able to convert svg to pdf/png/eps…


1. Create the install_inkscape script

echo "----------------"
echo "Install Inkscape"
echo "----------------"
echo ""
echo "1. Download AppImage"
wget --no-verbose -O Inkscape.AppImage
echo ""

echo "2. Make it executable"
chmod +x Inkscape.AppImage
echo ""

echo "3. Extract the AppImage, and immediately clean up"
./Inkscape.AppImage --appimage-extract > /dev/null
rm Inkscape.AppImage
echo ""

echo "4. Rename to a sensible foldername, inkscape-root"
mv squashfs-root inkscape-root
echo ""

echo "5. Adding a link in .global/bin to inkscape"
mkdir -p .global/bin
ln -s /app/inkscape-root/AppRun .global/bin/inkscape
echo ""

echo "6. All Done"
echo "You can test if it is working by running "
echo "  inkscape --version 2>/dev/null"
echo ""
echo "To convert a file, try: " 
echo "  inkscape --without-gui Tiger.svg -w 320 -h 320 -o Tiger.png 2>/dev/null"
echo ""
echo " Enjoy ! "
echo "----------------"

2. Add it to the build hook

    build: |
        set -e

3. Use it

Note that we’re adding 2>/dev/null at the end of the command to ensure inkscape doesn’t spam the CLI too much.

echo "download an svg to test with (errors will be ignored, because inkscape spams a lot)"
wget --no-verbose -O /tmp/Tiger.svg
inkscape Tiger.svg -w 320 -h 320 -o Tiger.png 2>/dev/null
1 Like