Skip to content

Instantly share code, notes, and snippets.

@aswinpajayan
Last active October 17, 2020 15:50
Show Gist options
  • Save aswinpajayan/4c37d1602cfeb89c6830ad4384a46088 to your computer and use it in GitHub Desktop.
Save aswinpajayan/4c37d1602cfeb89c6830ad4384a46088 to your computer and use it in GitHub Desktop.
Commands to convert pdf to image and adjust threshold
# change policy modules in image magick
#<!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
#<policy domain="coder" rights="read|write" pattern="PDF" />
# add line <policy domain="coder" rights="read|write" pattern="LABEL" />
#copy file to to any folder (one file per folder)
convert -density 72 Kashyapa\ samhitha\ Full.pdf -quality 90 output.jpg
mkdir out
for file in *.jpg;do convert $file -channel RGB -threshold 42% out/$file.jpg; done
#!/bin/bash
for i in `ls`; do convert $i -fuzz 100% -fill '#f2f2f2' -region 100x100+50+50 -opaque white $i;done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment