#!/bin/bash DPI="${DPI:-192}" FROM="$1" DST="$2" BGARGS="$3" if [ "${FROM}" = "" ]; then echo "pdf2png from-file [to-file]" fi if [ "${DST}" = "-white" ]; then DST="" BGARGS="white" fi if [ "${DST}" = "" ]; then DST="${FROM/.pdf/.png}" fi if [ "${BGARGS}" != "" ]; then BGARGS="-background ${BGARGS} -alpha background -alpha remove" fi convert -density "${DPI}" -strip -trim "${FROM}" -quality 100 ${BGARGS} "${DST}"