Skip to content

Instantly share code, notes, and snippets.

@higemaru
Created June 2, 2013 11:40
Show Gist options
  • Save higemaru/5693391 to your computer and use it in GitHub Desktop.
Save higemaru/5693391 to your computer and use it in GitHub Desktop.
* jpg2pdf * jpg dirname = pdf filename = pdf meta title * Sony Reader resolution = 584 x 754
#!/bin/bash
_DIR="$1";
_NAME=`basename $_{DIR}`
_OIFS=${IFS}
IFS="
"
cd "$_{DIR}";
for file in `ls|perl -MSort::Naturally -e 'print nsort <>'`;do
convert -density 72x72 -resize x754 $file $(printf %04d $i).jpg
rm $file;
done;
convert *.jpg dummy.pdf
echo "InfoKey: Title
InfoValue: ${_NAME}" > dummy.info
pdftk dummy.pdf update_info_utf8 dummy.info output "${_NAME}.pdf"
rm dummy.info dummy.pdf
IFS=${_OIFS}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment