diff --git a/command-line/tools/README.md b/command-line/tools/README.md index dce583b..86b2548 100644 --- a/command-line/tools/README.md +++ b/command-line/tools/README.md @@ -34,6 +34,18 @@ Usage: Link: +## OSP-tools: `resample.sh` + +Dependencies: + +- `gs` (Ghostscript) + +This will change the resolution of a PDF. + +Usage: + + ./resample input.pdf 150 + ## Custom VR tools: `make-images-bw.sh` Dependencies: diff --git a/command-line/tools/resample.sh b/command-line/tools/resample.sh new file mode 100755 index 0000000..28f4270 --- /dev/null +++ b/command-line/tools/resample.sh @@ -0,0 +1,18 @@ +#! /bin/bash + +pdffile=$1; +dpi=$2 + +gs \ + -o "${pdffile%.pdf}-resampled.pdf" \ + -sDEVICE=pdfwrite \ + -dDownsampleColorImages=true \ + -dDownsampleGrayImages=true \ + -dDownsampleMonoImages=true \ + -dColorImageResolution=$dpi \ + -dGrayImageResolution=$dpi \ + -dMonoImageResolution=$dpi \ + -dColorImageDownsampleThreshold=1.0 \ + -dGrayImageDownsampleThreshold=1.0 \ + -dMonoImageDownsampleThreshold=1.0 \ + "${pdffile}"