#! /bin/zsh # # this file: # https://dataswamp.org/~incal/conf/.zsh/jpg2pdf jpg2pdf-paper () { local paper_size=$1 shift local pic local pic_name local module=viewjpeg.ps local pdf for f in $@; do pic=$f pic_name=${pic:r} pdf=${pic_name}-${paper_size}.pdf gs -sDEVICE=pdfwrite \ -sPAPERSIZE=$paper_size \ -o $pdf \ $module \ -c "($pic) viewJPEG showpage" done } jpg2pdf-a3 () { jpg2pdf-paper a3 $@ } jpg2pdf-a4 () { jpg2pdf-paper a4 $@ } jpg2pdf-a5 () { jpg2pdf-paper a5 $@ } alias jpg2pdf=jpg2pdf-a4