Last active
June 18, 2021 09:46
-
-
Save prateekrajgautam/f892d853d60bb70c6fe5cc6ffc9c281f to your computer and use it in GitHub Desktop.
PDF to JPG batch conversion on linux
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
#!/bin/bash | |
sudo apt-get install poppler-utils | |
mkdir ConvertedJPG | |
echo "hi" | |
for f in * | |
do | |
echo "converting" $f | |
pdftoppm -jpeg -rx 300 -ry 300 "$f" JPG | |
echo "moving converted JPG to " $f "\n" | |
mkdir "./ConvertedJPG/$f" | |
mv *.jpg "./ConvertedJPG/$f/" | |
done | |
## It will convert all the pdf in script folder to JPG in their respective names | |
##First Page only in seprate folder | |
#!/bin/bash | |
sudo apt-get install poppler-utils | |
mkdir FistPageJPG | |
echo "hi" | |
for f in * | |
do | |
echo "converting" $f | |
#pdftoppm -jpeg -rx 300 -ry 300 "$f" JPG | |
pdftoppm -jpeg -r 300 -f 1 -l 1 "$f" "$f" | |
echo "moving converted JPG to " $f "\n" | |
mv *.jpg "./FistPageJPG/" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment