Table of Contents

Convert to JPG

mogrify -format jpg *.bmp

Convert images to PDF

convert pages_*.png final.pdf
convert pages_*.png -resize 50% -compress jpeg -quality 75 final.pdf

merge PDFs

pdfunite in-1.pdf in-2.pdf in-n.pdf out.pdf

Process PDF pages

convert -density 300 scanned.pdf output-%02d.png
 
convert output*.png -normalize -threshold 80% normal.png
# or
convert output*.png +dither -colors 2 -colorspace Gray -normalize normal.png
# or
convert output*.png -monochrome normal.png # <-- this product nice dithered B&Wimage
 
convert normal*.png final.pdf

One liner:

convert -density 300 scanned.pdf -monochrome output.pdf
convert -density 300 scanned.pdf -normalize -threshold 70% output.pdf

Rename images to EXIF date

Use krename application.

jhead

jhead -n%Y%m%d-%H%M%S *.jpg 

exiv2

exiv2 -k -r '%Y-%m-%d_%H-%M-%S_:basename:' rename ā€œ$iā€ exiv2 -v -r '%Y%m%d.%H%M%S.:basename:' rename ā€œ$iā€

exiftool

exiftool -d %Y-%m-%d_%H-%M-%S%%-c.%%e "-filename<CreateDate" DIR 
If you want to keep track of original filename and write extension lower case:
 
exiftool -d %Y%m%d_%H%M%S%%-c-%%f.%%le "-filename<DateTimeOriginal" [.|DIR]
The same works also with the whole filename in lowercase:
 
exiftool -d %Y%m%d_%H%M%S%%-c-%%lf.%%le "-filename<DateTimeOriginal" [.|DIR]

Remove EXIF data

for i in *.jpg; do echo "Processing $i"; exiftool -all= "$i"; done