- Extract the pictures from the pdf file
pdfimage some.pdf book
It is better to use pdfimage than to do
convert some.pdf some.jpg
- View with a picture viewer to determine the area you want to crop.
- Then run the following bash scripts
#!/usr/bin/env bash page=0 for i in *pbm do let page=page+1 #crop dimensions and offsets convert $i -crop 1850x1200+30+30 $page.jpg let page=page+1 convert $i -crop 1850x1200+30+1400 $page.jpg done # # you may also want to adjust the page numbers, e.g. #for i in `seq 111 -2 1` #do # let j=$i+2 # mv $i.jpg $j.jpg #done # # let the jpg files have the same name length # usually a book has less than 1000 pages for i in ?.jpg do mv $i 00$i done for i in ??.jpg do mv $i 0$i done convert *jpg tgt.pdf
Note,
- pbm is for monochrome images, ppm is for non-monochrome images.
- change to png format to reduce the pdf file size if it is black and white.
没有评论:
发表评论