From cf80180f2d29339050da189957cbec5d67eb28fb Mon Sep 17 00:00:00 2001 From: "mb@ts" Date: Thu, 9 Jun 2022 11:34:24 +0200 Subject: [PATCH] adding resample to the toolbox --- command-line/tools/README.md | 12 ++++++++++++ command-line/tools/resample.sh | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 command-line/tools/resample.sh 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}"