These code samples will walk you through an admittedly specific scenario to demonstrate intro level concepts in image manipulation and processing via the command line interface. This will cover converting raster/bitmap images and SVGs, tracing image to SVG files, and some basic image manipulations like inverting and scaling.
These examples are written specifically for macOS, but most everything should translate pretty well to any *nix system.
You'll need the following software installed.
In this tutorial, we're only using the convert
command from ImageMagick, but
your best bet is to just install all of ImageMagick.
- GIMP:
brew install --cask gimp
- Inkscape:
brew install --cask inkscape
- ImageMagick:
brew install imagemagick
- Potrace:
brew install potrace
- bc:
brew install bc
There are
5AC7
two sets of examples. In the steps/
directory is each step in the
process broken out into separate bash scripts. This example processes a single
image whose name is hard-coded.
The second example, in script/
is a fully functional bash script that reads
its images from the input/
subdirectory and writes images and SVGs to
output/
.
This code is offered under MIT license. The sample images that accompany this code are not covered by the MIT license. All rights to the images remain with the owner. They are used here with permission and may be freely downloaded with this source code for educational purposes only.