ghostscript-parallel: Let Ghostscript render pages in parallel

[ bsd3, graphics, program ] [ Propose Tags ]

This is intended for rendering PostScript or PDF documents using Ghostscript. Ghostscript has the option -dNumRenderingThreads but it does not speedup pretty much, because it renders each page using multiple threads.

This program runs Ghostscript multiple times on distinct page subsets, such that Ghostscript can render pages in parallel.

gs-parallel has its own options, interprets them and converts and passes them to gs, but it also allows to pass custom options to gs after --.

Run it like so:

gs-parallel input.pdf page%04d.png -j4 -- -sDEVICE=png16m -dNOPAUSE -dBATCH

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS] 0.0, 0.0.1
Dependencies base (>=4.5 && <5), directory (>=1.3 && <1.4), non-empty (>=0.3.4 && <0.4), optparse-applicative (>=0.11 && <0.19), pooled-io (>=0.0.2 && <0.1), process (>=1.6 && <1.7), shell-utility (>=0.1 && <0.2), utility-ht (>=0.0.10 && <0.1) [details]
License BSD-3-Clause
Author Henning Thielemann
Category Graphics
Home page
Source repo this: darcs get --tag 0.0.1
head: darcs get
Uploaded by HenningThielemann at 2024-01-07T19:13:55Z
Distributions LTSHaskell:0.0.1, NixOS:0.0.1, Stackage:0.0.1
Executables gs-parallel
Downloads 81 total (9 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2024-01-07 [all 1 reports]

Readme for ghostscript-parallel-0.0.1

[back to package description]


The most simple call is:

gs-parallel input.pdf page%04d.png -j4 -- -sDEVICE=png16m -dNOPAUSE -dBATCH

This converts the document input.pdf to a series of PNGs, one for each page. It splits the range of all pages in four almost equally sized ranges and forks a ghostscript instance for each of these ranges.

If there is a cluster of pages that requires an especially long render time, then it might be useful to chop the page set into more smaller chunks.

gs-parallel input.pdf page%04d.ppm -j4 --chunk-size 100 \
    -- -sDEVICE=ppmraw -dNOPAUSE -dBATCH

This will process a document with 910 pages in chunks of sizes 100, 100, ..., 100, 10.

If you want a more balanced series of chunk sizes, use the option --max-chunk-size instead:

gs-parallel input.pdf page%04d.tif -j4 --max-chunk-size 100 \
    -- -sDEVICE=tif24nc -dNOPAUSE -dBATCH

It will process 10 chunks of size 91.

For selecting a subrange of pages, you must use the options --first-page and --last-page instead of the gs options -dFirstPage and -dLastPage, because gs-parallel must know the selected pages.

Known issues

We do not escape the pdf file path for page counting, this may cause problems.