Skip to content

Commit

Permalink
use jpeg compression in tiff2pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed Feb 11, 2020
1 parent 186330c commit a94779b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions make-booky
Expand Up @@ -14,7 +14,7 @@ number_of_pages="$(($(find . | wc -l) - 1))"
# if number_of_pages is odd
if ((number_of_pages % 2)); then
echo "making page 1 a loose leaf"
mv page-1.jpeg bind-0.jpeg
convert page-1.jpeg bind-0.tiff
for i in $(seq 2 $((number_of_pages))); do
mv page-"$i".jpeg page-"$((i - 1)).jpeg"
done
Expand All @@ -26,12 +26,11 @@ end=$((number_of_pages / 2))
for i in $(seq 0 $((end - 1))); do
page=$((i + 1))
echo "binding page $page"
convert -quality 100 "page-$page.jpeg" "page-$((number_of_pages - i)).jpeg" +append "bind-$page.jpeg"
jpegoptim --all-progressive -v --strip-all --max=100 --preserve "bind-$page.jpeg"
convert "page-$page.jpeg" "page-$((number_of_pages - i)).jpeg" +append "bind-$page.tiff"
done

#tiffcp -c lzw bind-*.tiff bound.tiff
#tiff2pdf -o "$filename.booky.pdf" bound.tiff
output="${filename%%.pdf}.booky.pdf"
convert -quality 100 bind-*.jpeg "$output"

tiffcp -c lzw bind-*.tiff bound.tiff
tiff2pdf -q 100 -jo "$output" bound.tiff
cp "$output" "$cwd"

0 comments on commit a94779b

Please sign in to comment.