Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #689

Re: Making thumbnails efficiently with ghostscript

From Thomas Kaiser <Thomas.Kaiser@phg-online.de>
Newsgroups comp.lang.postscript, comp.text.pdf
Subject Re: Making thumbnails efficiently with ghostscript
Followup-To comp.text.pdf
Date 2012-05-22 14:11 +0000
Organization http://kaiser-edv.de
Message-ID <slrnjrn7kd.26fn.Thomas.Kaiser@phg-online.de> (permalink)
References <PKKdnck_eruzEibSnZ2dnUVZ8lSdnZ2d@brightview.co.uk>

Cross-posted to 2 groups.

Followups directed to: comp.text.pdf

Show all headers | View raw


["Followup-To:" comp.text.pdf]
bugbear wrote in <news:PKKdnck_eruzEibSnZ2dnUVZ8lSdnZ2d@brightview.co.uk>
> I would like to use ghostscript to make a thumbnail of the first page of a PDF file,
> or an EPSF file, to the following spec.
>
> * The thumbnail must have the SAME aspect ratio as the original
> * the size of the longest side of the thumbnail must be 128 pixels
>
> The correct pixels can be easily made, by simply rendering at a 
> "too-high" resolution, and then using ImageMagick:

Use the dimensions of the trimbox (or mediabox if missing), do some math 
to get the approriate resolution for an image with at least 256x256 
pixels and then use this as $MyRenderResolution. This

    gs -dUseTrimBox -q -dBATCH -dNOPAUSE -r${MyRenderResolution} \
    -sDEVICE=... -dDOINTERPOLATE -dTextAlphaBits=4 -dGraphicsAlphaBits=4 \
    -dMaxBitmap=100000000 -dMaxPatternBitmap=2000000 -sOutputFile=... \
    -c 100000000 setvmthreshold -f /path/to/pdf

will produce an image with correct aspect ratio (-dTextAlphaBits=2 and 
-dGraphicsAlphaBits=2 should work a bit faster without decreasing 
rendering quality since you get an image with twice the pixel dimensions 
as necessary).

When you scale down using ImageMagic in a second step you can then apply 
some slight sharping or unsharp masking which will produce superiour 
results.

Regards,

Thomas

Back to comp.lang.postscript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Making thumbnails efficiently with ghostscript bugbear <bugbear@trim_papermule.co.uk_trim> - 2012-05-22 14:05 +0100
  Re: Making thumbnails efficiently with ghostscript Thomas Kaiser <Thomas.Kaiser@phg-online.de> - 2012-05-22 14:11 +0000

csiph-web