From caf5420eb9c8f417ae23f60f37f81ffb02b6c764 Mon Sep 17 00:00:00 2001 From: manetta Date: Mon, 2 Nov 2020 13:49:29 +0000 Subject: [PATCH] adding a resample notebook to the pdf-toolkit --- pdf-toolkit/resample.ipynb | 74 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 pdf-toolkit/resample.ipynb diff --git a/pdf-toolkit/resample.ipynb b/pdf-toolkit/resample.ipynb new file mode 100644 index 0000000..7691298 --- /dev/null +++ b/pdf-toolkit/resample.ipynb @@ -0,0 +1,74 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Resample (thanks OSP!) using GS (ghostscript)" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "GPL Ghostscript 9.27 (2019-04-04)\n", + "Copyright (C) 2018 Artifex Software, Inc. All rights reserved.\n", + "This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:\n", + "see the file COPYING for details.\n", + "Processing pages 1 through 1.\n", + "Page 1\n", + "Loading NimbusMonoPS-Regular font from /usr/share/ghostscript/9.27/Resource/Font/NimbusMonoPS-Regular... 4732016 3198530 2340840 976702 4 done.\n" + ] + } + ], + "source": [ + "!gs \\\n", + " -o \"resampled.pdf\" \\\n", + " -sDEVICE=pdfwrite \\\n", + " -dDownsampleColorImages=true \\\n", + " -dDownsampleGrayImages=true \\\n", + " -dDownsampleMonoImages=true \\\n", + " -dColorImageResolution=300 \\\n", + " -dGrayImageResolution=300 \\\n", + " -dMonoImageResolution=300 \\\n", + " -dColorImageDownsampleThreshold=1.0 \\\n", + " -dGrayImageDownsampleThreshold=1.0 \\\n", + " -dMonoImageDownsampleThreshold=1.0 \\\n", + " \"pdf/test.pdf\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}