Attempt to perform an operation not allowed by the security policy `PDF’
Change
<policy domain="coder" rights="none" pattern="PDF" />
to
<policy domain="coder" rights="read | write" pattern="PDF" />
in /etc/ImageMagick-?/policy.xml
.
Change
<policy domain="coder" rights="none" pattern="PDF" />
to
<policy domain="coder" rights="read | write" pattern="PDF" />
in /etc/ImageMagick-?/policy.xml
.
Auto align images using Hugin (source images might need the exact same resolution):
align_image_stack -m -a output_prefix input1.png input2.png
Median blend images using Imagemagick:
convert output_prefix*.tif -evaluate-sequence median output.png
…while dealing with alpha/transparency:
convert -verbose -density 150 -trim <input>[PAGE-RANGE] -quality 100 -sharpen 0x1.0 -background white -alpha remove <output>
pdf2jpg.sh
, usage: pdf2jpg.sh <input> [page-range]
, page range starting at 0
.
#!/bin/bash
INPUT=$1
PAGES=$2
ME=`basename "$0"`
if [[ ! -f "${INPUT}" ]]
then
echo "Input not found"
echo "Usage: ${ME} <pdf> [[pages]]"
exit 1
fi
if [[ $(file --mime-type -b "${INPUT}") != "application/pdf" ]]
then
echo "Input not a PDF"
exit 1
fi
BASENAME="`basename "${INPUT}" .pdf`"
OUTPUT=$(mktemp -q -u "${BASENAME}.XXXXXXXXX")
convert -verbose -density 150 -trim "${INPUT}${PAGES}" -quality 100 -sharpen 0x1.0 -background white -alpha remove "${OUTPUT}-%03d.jpg"