02 Jun 2024
Dicovered via !helpers/cli-imagemagick - this is a better way to handle svg
to png
conversions & resizing.
![logo](https://ik.imagekit.io/vhucnsp9j1u/images/logos/inkscape.png)
Install with brew (installs the app with --cask
but only interested in CLI tools):
brew install --cask inkscape
use as:
inkscape zurich.svg --export-type=png --export-filename=zurich.png --export-width=2000
Resize within fixed dimension canvas
3 steps:
inkscape zurich.svg --export-type=png --export-filename=temp_scaled.png --export-width=1000 --export-background-opacity=0 --export-area-drawing
matched to the highest dimension.
then
magick temp_scaled.png -background none -gravity center -extent 1000x1000 zurich.png
finally:
rm temp_scaled.png
A Python script is possibly the best approach here.