Last active
May 4, 2020 14:47
-
-
Save lukestanley/afd119f06649df2726faa8ce4e27c220 to your computer and use it in GitHub Desktop.
Compress PDF as JPG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adjust these variables as desired: | |
quality=80 | |
density=200 | |
convert -density $density "$1" -background white -alpha remove -alpha off -compress none BMP3:_temp_conv_file%02d.bmp | |
for f in _temp_conv_file*.bmp; | |
do | |
cjpeg -quality $quality -outfile "$f.jpg" "$f"; | |
done; | |
img2pdf *.jpg -o "compressed_$1" | |
for f in _temp_conv_file*.bmp; | |
do | |
rm "$f.jpg"; | |
rm "$f"; | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This could make a PDF larger. Variables may need adjusting.