🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.linux.misc
Article #2583

Re: Shrinking huge PDF files

#2583
From: Nuno Silva
Date: Sun, 15 Nov 2026 01:28
60 lines
3739 bytes
On 2026-11-15, Charlie Gibbs wrote:

> [Here's an on-charter post for a change...]
>
> I was given some scans of sheet music from an iPad vict^H^H^H^Huser who
> couldn't find the settings (if it has any) for its scanning function.
> As a result, she wound up with a 9-page PDF file that takes up over
> 30 megabytes.  (When I scan a similar document on my machine the file
> is about one megabyte.)  A bit of digging came up with utilities that
> tell me that her scan is in 24-bit colour at some ungodly resolution
> (using JPEG to keep it from being even bigger).
>
> I've been looking at utilities like Ghostscript, but the documentation
> is making my eyes glaze over.  Is there a guide that can help me
> re-sample the file, say to 300 dpi in monochrome?
>
> I suppose the alternative would be to have the user find someone
> who could help her beat macOS into submission, but that might
> wind up more like that episode of "The Big Bang Theory":
>
> Leonard: Oh, screw the roommate agreement.
> Sheldon: No!  You don't screw the roommate agreement.
>           The roommate agreement screws _you_!
>
> aTdHvAaNnKcSe...

If the pages are regular images in the PDF (and not e.g. some composite
image using some technique to achieve separate layers using different
images in the same page), I'd extract them with pdfimages (from
libpoppler, probably with the -all option (-j has served me well in the
past, but I should have chosen -all?)), convert to a different
colorspace using imagemagick or equivalent, and then either re-assemble
these in a PDF file or create a ZIP file with the extension .CBZ (in
case that increases the chances of document viewers handling it as a
collection of pages in a ZIP archive).

(Actually, I'd probably first see if they could convert to monochrome
well, playing with the threshold in imagemagick's convert, and if so I'd
instead use cjb2 and djvm to turn the whole thing into a DjVu file.)

But IIRC Ghostscript does indeed have something for resolution and
colorspace, let me see if I have something written down... yes, part of
a command I wrote down has:

    gs -sDEVICE=pdfwrite -sColorConversionStrategy=Gray \
       -sProcessColorModel=DeviceGray

But I have no idea if this actually worked or if it was just something I
wrote down while trying to make it work.


From a web search, I guess this is the web version of the current
manual?:
<https://ghostscript.readthedocs.io/en/latest/VectorDevices.html>

(Also see {Color,Gray,Mono}ImageResolution, which are listed there but
are not documented at least on this section?)

-- 
Nuno Silva
Technical Details
Message-ID: <11db1rn$2cjla$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <Qq7KS.9052$s53.4981@fx10.iad>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Nuno Silva <nunojsilva@invalid.invalid>
Newsgroups: comp.os.linux.misc
Subject: Re: Shrinking huge PDF files
Date: Sun, 15 Nov 2026 01:28:23 +0000
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <11db1rn$2cjla$1@dont-email.me>
References: <Qq7KS.9052$s53.4981@fx10.iad>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Sun, 15 Nov 2026 01:28:23 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2510506"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/po2DWJ9+S5k5UqK8jh5O3"; posting-host="30590866acd87ae4e8f60e28d2987d87"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
Cancel-Lock: sha1:NHPOeq60ATtW6ZYmREr9zOCKsUE= sha256:OeoyGwXZoOtWO+mFwoFBt+h2NMDqLHvZEOYTSqpG7To=
	sha1:7+CpNmSrZa7iOv/EFnpuQGrqjmo= sha256:vM9RFmb8D64rRf8ANfRz1/gdjyvqhfJRtdFdhKgbJ5w=