Skip to content

Instantly share code, notes, and snippets.

@shane5ul
Created April 17, 2024 12:11
Show Gist options
  • Save shane5ul/ac06e22a10ee05c9c2f037cf6bd096b8 to your computer and use it in GitHub Desktop.
Save shane5ul/ac06e22a10ee05c9c2f037cf6bd096b8 to your computer and use it in GitHub Desktop.
Some journals require a table of contents or highlights graphic in TIFF format. If you use Inkscape to generate such images on a Linux box like I do, then the following script (thanks to Matsen https://gist.github.com/matsen/4263955) is quite helpful in generating unbloated TIFF files with 300dpi.
#!/bin/sh
# Convert all arguments (assumed SVG) to a TIFF acceptable to PLOS
# Requires Inkscape and ImageMagick 6.8 (doesn't work with 6.6.9)
for i in $(ls *.svg | cut -d. -f1); do
inkscape --without-gui --export-png="${i}.png" --export-dpi 300 --export-area-drawing ${i}.svg
convert -compress LZW -alpha remove -trim ${i}.png ${i}.tiff
mogrify -alpha off -geometry 1000x ${i}.tiff
rm ${i}.png
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment