#!/bin/bash set -x # $1: filename of the PDF # $2: the prefix after printout echo "Transforming PDF ${1} to ${2}-printout/${2}..." rm -rf ${2}-printout && mkdir ${2}-printout pdftoppm -jpeg -r 128 $1 ${2}-printout/$2 for pic in ${2}-printout/*.jpg; do composite -dissolve 30% -gravity south ../.layouts/notes-watermark.png $pic ${pic//.jpg}-marked.jpg rm -f $pic done set +x for pic in ${2}-printout/*-marked.jpg; do echo "![](${pic})" done