Skip to content

Instantly share code, notes, and snippets.

@WebReflection
Last active February 21, 2025 18:08
Show Gist options
  • Save WebReflection/b5ab5f1eca311b76835c to your computer and use it in GitHub Desktop.
Save WebReflection/b5ab5f1eca311b76835c to your computer and use it in GitHub Desktop.
Transform AI to SVG, requires Inkscape

Save this file as ai2svg, make it executable via chmod +x ai2svg then run it optionally passing the folder to look for.

It will convert in that folder, or the current one, all .ai files into .svg

#!/usr/bin/bash

createsvg() {
  local margin="$1"
  local d
  local svg
  for d in *.ai; do
    svg=$(echo "$d" | sed 's/.ai/.svg/')
    echo "creating $svg ..."
    # old version: inkscape "$d" -l -o "$svg"
    if [ "$margin" != "" ]; then
      inkscape "$d" --export-area-drawing --export-margin $margin "--export-plain-svg=$svg"
    else
      inkscape "$d" --export-area-drawing "--export-plain-svg=$svg"
    fi
  done
}

if [ "$1" != "" ];then
  cd $1
fi

createsvg "$2"
@adrianoresende
Copy link

Warning: Option --export-plain-svg= is deprecated

any source, inkscape version, replacement solution ?

Inkscape 1.3.2 (091e20e, 2023-11-25)

My SVG was converted without color; then I set the colors manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment