Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.misc > #95654 > unrolled thread
| Started by | Charlie Gibbs <cgibbs@kltpzyxm.invalid> |
|---|---|
| First post | 2026-11-15 00:56 +0000 |
| Last post | 2026-11-17 07:25 +1000 |
| Articles | 20 on this page of 36 — 14 participants |
Back to article view | Back to comp.os.linux.misc
Shrinking huge PDF files Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2026-11-15 00:56 +0000
Re: Shrinking huge PDF files "Carlos E.R." <robin_listas@es.invalid> - 2026-11-15 02:16 +0100
Re: Shrinking huge PDF files Nuno Silva <nunojsilva@invalid.invalid> - 2026-11-15 10:40 +0000
Re: Shrinking huge PDF files "Carlos E.R." <robin_listas@es.invalid> - 2026-11-15 13:29 +0100
Re: Shrinking huge PDF files Nuno Silva <nunojsilva@invalid.invalid> - 2026-11-15 01:28 +0000
Re: Shrinking huge PDF files Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-11-15 01:49 +0000
Re: Shrinking huge PDF files 🇵🇱Jacek Marcin Jaworski🇵🇱 <jmj@energokod.gda.pl> - 2026-11-15 03:26 +0100
Re: Shrinking huge PDF files Rich <rich@example.invalid> - 2026-11-15 03:16 +0000
Re: Shrinking huge PDF files Andreas Eder <a_eder_muc@web.de> - 2026-11-15 10:50 +0100
Re: Shrinking huge PDF files Russell Marks <zgedneil@spam^H^H^H^Hgmail.com> - 2026-11-15 10:18 +0000
Re: Shrinking huge PDF files Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2026-11-15 23:31 +0000
Re: Shrinking huge PDF files c186282 <c186282@nnada.net> - 2026-11-15 22:16 -0500
Re: Shrinking huge PDF files Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2026-11-16 05:04 +0000
Re: Shrinking huge PDF files Mike Scott <usenet.16@scottsonline.org.uk.invalid> - 2026-11-16 07:09 +0000
Re: Shrinking huge PDF files Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2026-11-16 17:02 +0000
Re: Shrinking huge PDF files The Natural Philosopher <tnp@invalid.invalid> - 2026-11-16 18:17 +0000
Re: Shrinking huge PDF files Rich <rich@example.invalid> - 2026-11-16 18:55 +0000
Re: Shrinking huge PDF files c186282 <c186282@nnada.net> - 2026-11-16 21:29 -0500
Re: Shrinking huge PDF files Nuno Silva <nunojsilva@invalid.invalid> - 2026-11-22 11:00 +0000
Re: Shrinking huge PDF files "Carlos E.R." <robin_listas@es.invalid> - 2026-11-16 09:47 +0100
Re: Shrinking huge PDF files Nuno Silva <nunojsilva@invalid.invalid> - 2026-11-16 08:56 +0000
djvu [Was: Re: Shrinking huge PDF files] "Carlos E.R." <robin_listas@es.invalid> - 2026-11-16 11:15 +0100
Re: djvu [Was: Re: Shrinking huge PDF files] Andy Burns <usenet@andyburns.uk> - 2026-11-16 13:18 +0000
Re: djvu [Was: Re: Shrinking huge PDF files] Rich <rich@example.invalid> - 2026-11-16 19:00 +0000
Re: djvu [Was: Re: Shrinking huge PDF files] Nuno Silva <nunojsilva@invalid.invalid> - 2026-11-23 00:13 +0000
Re: djvu [Was: Re: Shrinking huge PDF files] "Carlos E.R." <robin_listas@es.invalid> - 2026-11-23 01:54 +0100
Re: djvu [Was: Re: Shrinking huge PDF files] Andy Burns <usenet@andyburns.uk> - 2026-11-23 06:35 +0000
Re: djvu [Was: Re: Shrinking huge PDF files] "Carlos E.R." <robin_listas@es.invalid> - 2026-11-17 03:00 +0100
Re: djvu [Was: Re: Shrinking huge PDF files] Rich <rich@example.invalid> - 2026-11-16 18:59 +0000
Re: Shrinking huge PDF files Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2026-11-16 17:02 +0000
Re: Shrinking huge PDF files Rich <rich@example.invalid> - 2026-11-16 19:01 +0000
Re: Shrinking huge PDF files Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2026-11-16 19:20 +0000
Re: Shrinking huge PDF files Leroy H <lh@somewhere.net> - 2026-11-16 20:03 +0000
Re: Shrinking huge PDF files Rich <rich@example.invalid> - 2026-11-16 22:04 +0000
Re: Shrinking huge PDF files Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2026-11-17 02:00 +0000
Re: Shrinking huge PDF files not@telling.you.invalid (Computer Nerd Kev) - 2026-11-17 07:25 +1000
Page 1 of 2 [1] 2 Next page →
| From | Charlie Gibbs <cgibbs@kltpzyxm.invalid> |
|---|---|
| Date | 2026-11-15 00:56 +0000 |
| Subject | Shrinking huge PDF files |
| Message-ID | <Qq7KS.9052$s53.4981@fx10.iad> |
[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...
--
/~\ Charlie Gibbs | In this world there are
\ / <cgibbs@kltpzyxm.invalid> | two kinds of people:
X I'm really at ac.dekanfrus | 1. Those who can extrapolate
/ \ if you read it the right way. | from incomplete data.
[toc] | [next] | [standalone]
| From | "Carlos E.R." <robin_listas@es.invalid> |
|---|---|
| Date | 2026-11-15 02:16 +0100 |
| Message-ID | <hndnsmxk4m.ln2@Telcontar.valinor> |
| In reply to | #95654 |
On 2026-11-15 01:56, 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? Convert to some bitmap image format, file per page (png, for instance) resample using gimp, or magick convert back to PDF, if that is the goal. Hint: don't fight documentation. Ask an AI to guide you on the use of ghostscript (if that is the tool you want to use). AIs are good at this. (no, I did not ask an AI for this post) -- Cheers, Carlos. ES🇪🇸, EU🇪🇺;
[toc] | [prev] | [next] | [standalone]
| From | Nuno Silva <nunojsilva@invalid.invalid> |
|---|---|
| Date | 2026-11-15 10:40 +0000 |
| Message-ID | <11dc276$2lrfq$3@dont-email.me> |
| In reply to | #95655 |
On 2026-11-15, Carlos E.R. wrote: > On 2026-11-15 01:56, 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? > > Convert to some bitmap image format, file per page (png, for instance) > resample using gimp, or magick For this I stress my recommendation of poppler's pdfimages. If I'm not mistaken, it will extract the image streams, not convert them. If all it has is one image per page, that's probably the best to avoid loss at this stage. (Well, if you do indeed convert to raster here, instead of extracting, you can probably use this step to convert the colorspace and (if needed) downsample the images.) > convert back to PDF, if that is the goal. > > > Hint: don't fight documentation. Ask an AI to guide you on the use of > ghostscript (if that is the tool you want to use). AIs are good at > this. > > (no, I did not ask an AI for this post) -- Nuno Silva
[toc] | [prev] | [next] | [standalone]
| From | "Carlos E.R." <robin_listas@es.invalid> |
|---|---|
| Date | 2026-11-15 13:29 +0100 |
| Message-ID | <56losmx4b3.ln2@Telcontar.valinor> |
| In reply to | #95670 |
On 2026-11-15 11:40, Nuno Silva wrote: > On 2026-11-15, Carlos E.R. wrote: > >> On 2026-11-15 01:56, 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? >> >> Convert to some bitmap image format, file per page (png, for instance) >> resample using gimp, or magick > > For this I stress my recommendation of poppler's pdfimages. If I'm not > mistaken, it will extract the image streams, not convert them. If all it > has is one image per page, that's probably the best to avoid loss at > this stage. Ok, yes. Although I used convert loosely, what I wanted to do is extract the original image inside. -- Cheers, Carlos. ES🇪🇸, EU🇪🇺;
[toc] | [prev] | [next] | [standalone]
| From | Nuno Silva <nunojsilva@invalid.invalid> |
|---|---|
| Date | 2026-11-15 01:28 +0000 |
| Message-ID | <11db1rn$2cjla$1@dont-email.me> |
| In reply to | #95654 |
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
[toc] | [prev] | [next] | [standalone]
| From | Lawrence D’Oliveiro <ldo@nz.invalid> |
|---|---|
| Date | 2026-11-15 01:49 +0000 |
| Message-ID | <11db33r$2dp0b$2@dont-email.me> |
| In reply to | #95654 |
On Sun, 15 Nov 2026 00:56:16 GMT, Charlie Gibbs wrote: > I've been looking at utilities like Ghostscript, but the > documentation is making my eyes glaze over. According to the docs <https://ghostscript.readthedocs.io/en/gs10.08.0/Devices.html>, the “pngmono” and “pngmonod” output devices should give you 1 bit per pixel, with the latter doing error-diffusion dithering. Or have a look at some of the other device options there.
[toc] | [prev] | [next] | [standalone]
| From | 🇵🇱Jacek Marcin Jaworski🇵🇱 <jmj@energokod.gda.pl> |
|---|---|
| Date | 2026-11-15 03:26 +0100 |
| Message-ID | <IdKdnRDIs8f9hWT3nZ2dnZfqn_idnZ2d@giganews.com> |
| In reply to | #95654 |
Z totaliztycznym salutem! NOTE: THIS IS ONLY DESCRIPTION "HOW TO CREATE HIGHLY COMPRESSED BLACK-AND-WHITE PDFS". SO IT IS UP TO YOU WRITE YOUR OWN USABLE SHELL SCRIPT!!! BECAUSE IT IS INFO FOR CLEVER HACKERS NOT FOR LAZY AND BRAINLESS LAMERS!!! THIS BROCHURE INTENTIONALLY RESPECT PROVERB: "A WORD TO THE WISE IS SUFFICIENT." Originally this was brochure written in polish "Skanowanie i Tworzenie Dok. PDF w Sys. Debian Ubuntu", chapter "4.1 Tworzenie Czarnobiałych Dok. PDF". This brochure is available as a PDF eBook from my WWW home page. It is available for free (as in "free beer"). <https://energokod.gda.pl/monografie/Skanowanie%20i%20Tworzenie%20Dok.%20PDF%20w%20Sys.%20Debian-Ubuntu.pdf> Translation was generated today by ChatGPT (OpenAI, GPT6): > ## 4.1 Creating Black-and-White PDF Documents > > Official documents, many university lecture notes, and numerous books are published in black and white. This makes it possible to significantly reduce the size of the resulting PDF document. > > The process of creating a PDF document consists of several steps: > > 1. Converting PNG files to PBM; > 2. Converting PBM files to DJVU; > 3. Combining all DJVU files into a single DJVU file; > 4. Converting the resulting DJVU file into the final PDF file. > > Conversion to DJVU is necessary because this format currently provides the best compression for scanned images containing text. Conversion to PBM is necessary because this is the input format accepted by the `cjb2` program, which generates DJVU files. > > ```bash > # To convert PNG files to PBM, call the following > # command in a loop: > convert "$lPNG" "$lPBM" > ``` > > Of course, you must assign the names of the files being converted to the `lPNG` and `lPBM` variables. > > ```bash > # To convert PBM files to DJVU, call cjb2 > # (Simple DjVuBitonal encoder) in a loop: > cjb2 -clean "$lPBM" "$lDJVU" > ``` > > Of course, you must assign the names of the files being converted to the `lPBM` and `lDJVU` variables. > > ```bash > # To merge individual DJVU files into a single > # temporary file named tmp.djvu: > djvm -c "./tmp.djvu" $(find . -maxdepth > 1 -type f -iname '*.djvu' | nsort) > ``` > > `nsort` is my own utility, which sorts filenames by their numeric values rather than by their ASCII codes. > > As an alternative, you can use the standard system `sort` command, provided that you use filenames with leading zeros, e.g. `00001.png`, `00002.png`, and so on. > > ```bash > # To convert the merged DJVU file to PDF: > ddjvu -format=pdf -quality=150 > "./tmp.djvu" "$gNazwaPDF" > ``` > > `-quality=150` provides the best quality. > > For testing purposes, I scanned the first four pages of an article entitled "The Return of Kakuro", from issue 77 (1/2025) of the two-colour magazine *Świat Matematyki*. > > To demonstrate the effectiveness of the compression, I also combined the PNG files into a PDF using the following command: > > ```bash > convert $(find . -maxdepth 1 -type f - > iname '*.png' | nsort) 'Powrót Kakuro.v2.pdf' > ``` > > The resulting files had the following sizes: > > ```text > 256975 'Powrót Kakuro.pdf' > 637496 'Powrót Kakuro.v2.pdf' > 154399 'Powrót Kakuro.djvu' > ``` > > This means that the resulting `Powrót Kakuro.pdf` file was 166% larger than the DJVU version, while the lossless version was 248% larger. -- Z totaliztycznym salutem! Jacek Marcin Jaworski, Pruszcz Gd., woj. Pomorskie, Polska 🇵🇱, UE 🇪🇺; Pryw. s. WWW: <https://energokod.gda.pl>; Pryw. tel.: +48-609-170-742; Netykieta: <https://energokod.gda.pl/Netykieta.html>.
[toc] | [prev] | [next] | [standalone]
| From | Rich <rich@example.invalid> |
|---|---|
| Date | 2026-11-15 03:16 +0000 |
| Message-ID | <11db86u$2eudg$1@dont-email.me> |
| In reply to | #95654 |
Charlie Gibbs <cgibbs@kltpzyxm.invalid> 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?
If it really is a "scan" (as in an image of a sheet of paper) and if
you are fine with it becoming monochrome, then you can do this:
$ gs -dNOPAUSE -q -r300 -sDEVICE=tiffg4 -dBATCH -sOutputFile=page%02d.tiff big-monster.pdf
This will give you a set of tiffg4 monochrome images, one for each
page, at 300dpi.
Then, you can reassemble a pdf by using 'tiff2pdf' from the libtiff
package like so:
$ tiffcp page*.tiff multi-page.tiff
$ tiff2pdf -o new-smaller-file.pdf multi-page.tiff
Note, if it is a 24bit scan, and the black's are not really black but
instead a dark grey, then the above will create a dithered output that
will look awful and will not G4 compress well at all.
In which case, you have extra work to do (and you also need the netpbm
utilities). First, convert to grey scale:
$ gs -dNOPAUSE -q -r300 -sDEVICE=pgmraw -dBATCH -sOutputFile=page%02d.pgm big-monster.pdf
Then threshold the grey scale to black, and convert back to G4 tiffs:
$ for page in page*.pgm ; do pgmtopbm -threshold -value 0.82 $page | pnmtotiff -g4 > ${page%.pgm}.tiff ; done
Set each tiff to say it is 300dpi
$ for page in page*.tiff ; do tiffset -s 296 2 $page ; tiffset -s 282 300 $page ; tiffset -s 283 300 $page ; done
Create a multipage tiff from the individual single page tiffs and then
create a pdf from the multi-page tiff:
$ tiffcp page*.tiff multi-page.tiff
$ tiff2pdf -o new-smaller-file.pdf multi-page.tiff
[toc] | [prev] | [next] | [standalone]
| From | Andreas Eder <a_eder_muc@web.de> |
|---|---|
| Date | 2026-11-15 10:50 +0100 |
| Message-ID | <87a4na779o.fsf@eder.anydns.info> |
| In reply to | #95654 |
On So 15 Nov 2026 at 00:56, 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? What I do ro make pdfs smaller is the following: # $1=input, $2=output gs -q -dNOPAUSE -dBATCH \ -sDEVICE=pdfwrite \ -sOutputFile="$2" \ -r1200 \ -dAutoRotatePages=/None \ -dCompressFonts=true \ -dDetectDuplicateImages \ -dEmbedAllFonts \ -dPDFSETTINGS=/prepress \ -dPrinted=false \ $zdistill $zres \ -f "$1" # # -r1200 is to avoid rendering on a tiny canvas, which can trip # heuristics of complicated fonts, as (relating to a Hans font) in: # https://bugs.ghostscript.com/show_bug.cgi?id=701753 # -dAutoRotatePages since no, we do not want pages randomly rotated. # -dCompressFonts seems not to hurt, and can save notable space. # -dDetectDuplicateImages similarly. # -dEmbedAllFonts usually but doesn't always work to embed fonts, # except that if downscaling images with zres, have to override. # -dPDFSETTINGS=/prepress needed for embedding with # 45-2/watters-litigator/doc.pdf (tb140) # -dPrinted=false is to preserve internal links within the pdf, # notably for the cover/cover3 in our tb*complete.pdf: # https://tex.stackexchange.com/questions/456896 For grayscale output, can add -sColorConversionStrategy=Gray \ -dProcessColorModel=/DeviceGray \ You can find full notes (e.g., options no longer used) and runnable scripts: https://github.com/TeXUsersGroup/tugboat/blob/trunk/misc/ps2pdf-tub https://github.com/TeXUsersGroup/tugboat/blob/trunk/misc/ps2pdf-gray-tub Hope this helps, 'Andreas -- ceterum censeo redmondinem esse delendam
[toc] | [prev] | [next] | [standalone]
| From | Russell Marks <zgedneil@spam^H^H^H^Hgmail.com> |
|---|---|
| Date | 2026-11-15 10:18 +0000 |
| Message-ID | <%FfKS.6730$5s3.683@usenetxs.com> |
| In reply to | #95654 |
Charlie Gibbs <cgibbs@kltpzyxm.invalid> wrote: > 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'm not sure about that, but here's one thing I ended up using recently to get smaller PDFs (possibly including some unnecessary options): gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen \ -dNOPAUSE -dBATCH -sOutputFile=out.pdf in.pdf It won't always make the file smaller, but did for me in some cases. That does a reduction to 72 DPI, but I think you can replace "/screen" with "/printer" to get 300. -Rus.
[toc] | [prev] | [next] | [standalone]
| From | Charlie Gibbs <cgibbs@kltpzyxm.invalid> |
|---|---|
| Date | 2026-11-15 23:31 +0000 |
| Message-ID | <NhrKS.21511$li3.13390@fx46.iad> |
| In reply to | #95668 |
Thanks, everyone, for your suggestions. Here's a history of my various attempts. To keep things simple, I extracted the first page of the 11-page original file (32,468,435 bytes) as follows: $ pdftk hugefile.pdf cat 1 output testfile.pdf This resulted in a file of 1,520,696 bytes; the reduction in size is a lot more than 11 to 1, so pdftk must be doing some magic of its own. $ pdfimages -list testfile.pdf page num type width height color comp bpc enc interp object ID x-ppi y-ppi size ratio -------------------------------------------------------------------------------------------- 1 0 image 1928 2754 icc 3 8 jpeg yes 6 0 72 72 1481K 9.5% This indicates colour (icc) with three 8-bit components per pixel. $ identify testfile.pdf testfile.pdf PDF 1944x2772 1944x2772+0+0 16-bit sRGB 9615B 0.010u 0:00.000 Now let's have GhostScript convert the file to grayscale, using a suggestion from Nuno Silva: $ gs -sDEVICE=pdfwrite -sColorConversionStrategy=Gray \ -sProcessColorModel=DeviceGray -sOutputFile=testfile2.pdf testfile.pdf This converted the file to grayscale (8 bits per pixel, still with JPEG compression; its size is now 359,415 bytes. Following the URL given by Lawrence D'Oliveiro <https://ghostscript.readthedocs.io/gs10.08.0/Devices.html> gave a bewildering array of possibilities (the GhostScript command "devicenames ==" is even more intimidating). Changing the device from pdfwrite to pngmono got the size down to 112,386 bytes. The ImageMagick utility "identify" says it's 8-bit grayscale. We're getting the file size down to something more reasonable. However, contrast isn't all that good. Let's see whether we can go for monochrome. Working with Rich's suggestions, I ran the following: $ gs -sDEVICE=pgmraw -sColorConversionStrategy=Gray \ -sProcessColorModel=DeviceGray -sOutputFile=testfile3.pgm testfile.pdf $ pgmtopbm -threshold -value 0.82 testfile3.pgm | pnmtotiff -g4 >testfile3.tif $ tiff2pdf -o testfile3.pdf testfile3.tif Bingo! I wound up with a crisp PDF file whose size is only 48,071 bytes: a 30-to-1 reduction. This size is typical of what I get when I do my own scanning. And by tweaking the threshold value from 0.82 to 0.9 I was able to bring out penciled notes without getting black blotches everywhere. Adding the capability to handle multi-page documents uncovered a few problems. The sizes of the images seem to vary from page to page, and some some pages have shadows that make it difficult to make pencil marks visible without getting those big black blotches I mentioned earlier. If I could persuade the person doing the scanning to be careful to avoid shadows, my final script should be able to do a wonderful job of cleaning up such files. This might not be an option, though - most people seem unable or unwilling to take the necessary care. At least the images aren't keystoned... Thanks, everyone, for your help! -- /~\ Charlie Gibbs | Life is perverse. \ / <cgibbs@kltpzyxm.invalid> | It can be beautiful - X I'm really at ac.dekanfrus | but it won't. / \ if you read it the right way. | -- Lily Tomlin
[toc] | [prev] | [next] | [standalone]
| From | c186282 <c186282@nnada.net> |
|---|---|
| Date | 2026-11-15 22:16 -0500 |
| Message-ID | <heednVhwn4gH6Gf3nZ2dnZfqnPSdnZ2d@giganews.com> |
| In reply to | #95696 |
On 11/15/26 18:31, Charlie Gibbs wrote: > Thanks, everyone, for your suggestions. Here's a history of my > various attempts. To keep things simple, I extracted the first > page of the 11-page original file (32,468,435 bytes) as follows: > > $ pdftk hugefile.pdf cat 1 output testfile.pdf > > This resulted in a file of 1,520,696 bytes; the reduction in size is > a lot more than 11 to 1, so pdftk must be doing some magic of its own. > > $ pdfimages -list testfile.pdf > page num type width height color comp bpc enc interp object ID x-ppi y-ppi size ratio > -------------------------------------------------------------------------------------------- > 1 0 image 1928 2754 icc 3 8 jpeg yes 6 0 72 72 1481K 9.5% > > This indicates colour (icc) with three 8-bit components per pixel. > > $ identify testfile.pdf > testfile.pdf PDF 1944x2772 1944x2772+0+0 16-bit sRGB 9615B 0.010u 0:00.000 > > Now let's have GhostScript convert the file to grayscale, > using a suggestion from Nuno Silva: > > $ gs -sDEVICE=pdfwrite -sColorConversionStrategy=Gray \ > -sProcessColorModel=DeviceGray -sOutputFile=testfile2.pdf testfile.pdf > > This converted the file to grayscale (8 bits per pixel, still with > JPEG compression; its size is now 359,415 bytes. > > Following the URL given by Lawrence D'Oliveiro > <https://ghostscript.readthedocs.io/gs10.08.0/Devices.html> > gave a bewildering array of possibilities (the GhostScript > command "devicenames ==" is even more intimidating). > Changing the device from pdfwrite to pngmono got the size down > to 112,386 bytes. The ImageMagick utility "identify" says it's > 8-bit grayscale. > > We're getting the file size down to something more reasonable. > However, contrast isn't all that good. Let's see whether we > can go for monochrome. > > Working with Rich's suggestions, I ran the following: > $ gs -sDEVICE=pgmraw -sColorConversionStrategy=Gray \ > -sProcessColorModel=DeviceGray -sOutputFile=testfile3.pgm testfile.pdf > $ pgmtopbm -threshold -value 0.82 testfile3.pgm | pnmtotiff -g4 >testfile3.tif > $ tiff2pdf -o testfile3.pdf testfile3.tif > > Bingo! I wound up with a crisp PDF file whose size is only 48,071 > bytes: a 30-to-1 reduction. This size is typical of what I get > when I do my own scanning. And by tweaking the threshold value > from 0.82 to 0.9 I was able to bring out penciled notes without > getting black blotches everywhere. > > Adding the capability to handle multi-page documents uncovered a > few problems. The sizes of the images seem to vary from page to > page, and some some pages have shadows that make it difficult to > make pencil marks visible without getting those big black blotches > I mentioned earlier. If I could persuade the person doing the > scanning to be careful to avoid shadows, my final script should > be able to do a wonderful job of cleaning up such files. This > might not be an option, though - most people seem unable or > unwilling to take the necessary care. At least the images > aren't keystoned... > > Thanks, everyone, for your help! Umm ... a two/three/four-stage CL 'solution' to what SHOULD be easy ? PDFs have a very useful place, but for SOME purposes they're an over-complex disaster.
[toc] | [prev] | [next] | [standalone]
| From | Charlie Gibbs <cgibbs@kltpzyxm.invalid> |
|---|---|
| Date | 2026-11-16 05:04 +0000 |
| Message-ID | <49wKS.17397$V43.12880@fx07.iad> |
| In reply to | #95701 |
On 2026-11-16, c186282 <c186282@nnada.net> wrote: > On 11/15/26 18:31, Charlie Gibbs wrote: > >> Thanks, everyone, for your suggestions. Here's a history of my >> various attempts. <snipped> > Umm ... a two/three/four-stage CL 'solution' to > what SHOULD be easy ? > > PDFs have a very useful place, but for SOME > purposes they're an over-complex disaster. Perhaps, but non-experts are used to them and they're an easy way to transmit images. And what I'm trying to do is not easy; I've been handed a PDF file scanned at 2400 dpi in 24-bit colour, which I want to transform into a monochrome file at 600 dpi. The 30-to-1 size advantage turns a file transfer that requires Google Drive or Dropbox into a simple e-mail attachment that displays quickly and is more readable. Yes, the ultimate solution would to have the person scanning the file set up appropriate settings. But if that person doesn't know the fine points of scanning and is at the mercy of Apple (or Microsoft or whoever), this might not be an option. -- /~\ Charlie Gibbs | In this world there are \ / <cgibbs@kltpzyxm.invalid> | two kinds of people: X I'm really at ac.dekanfrus | 1. Those who can extrapolate / \ if you read it the right way. | from incomplete data.
[toc] | [prev] | [next] | [standalone]
| From | Mike Scott <usenet.16@scottsonline.org.uk.invalid> |
|---|---|
| Date | 2026-11-16 07:09 +0000 |
| Message-ID | <11dea7v$3c2sa$1@dont-email.me> |
| In reply to | #95705 |
On 16/11/2026 05:04, Charlie Gibbs wrote: > On 2026-11-16, c186282 <c186282@nnada.net> wrote: > >> On 11/15/26 18:31, Charlie Gibbs wrote: >> >>> Thanks, everyone, for your suggestions. Here's a history of my >>> various attempts. > > <snipped> > >> Umm ... a two/three/four-stage CL 'solution' to >> what SHOULD be easy ? >> >> PDFs have a very useful place, but for SOME >> purposes they're an over-complex disaster. > > Perhaps, but non-experts are used to them and they're an > easy way to transmit images. And what I'm trying to do > is not easy; I've been handed a PDF file scanned at 2400 > dpi in 24-bit colour, which I want to transform into a > monochrome file at 600 dpi. The 30-to-1 size advantage > turns a file transfer that requires Google Drive or Dropbox > into a simple e-mail attachment that displays quickly and > is more readable. GIMP might possibly help? Off the top of my head, import your pdf with pages as layers, fiddle with colour, size and resolution, then export layers as pages in a pdf. > > Yes, the ultimate solution would to have the person scanning > the file set up appropriate settings. But if that person > doesn't know the fine points of scanning and is at the mercy > of Apple (or Microsoft or whoever), this might not be an option. > -- Mike Scott Harlow, England
[toc] | [prev] | [next] | [standalone]
| From | Charlie Gibbs <cgibbs@kltpzyxm.invalid> |
|---|---|
| Date | 2026-11-16 17:02 +0000 |
| Message-ID | <wGGKS.129465$aI4.23956@fx15.iad> |
| In reply to | #95706 |
On 2026-11-16, Mike Scott <usenet.16@scottsonline.org.uk.invalid> wrote: > GIMP might possibly help? Off the top of my head, import your pdf with > pages as layers, fiddle with colour, size and resolution, then export > layers as pages in a pdf. That's an interesting possibility. And maybe the Gimp can do some equivalent of dodging to try to lighten up the shawdowed areas before converting to monochrome. -- /~\ Charlie Gibbs | In this world there are \ / <cgibbs@kltpzyxm.invalid> | two kinds of people: X I'm really at ac.dekanfrus | 1. Those who can extrapolate / \ if you read it the right way. | from incomplete data.
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2026-11-16 18:17 +0000 |
| Message-ID | <11dfhbo$3pnfh$1@dont-email.me> |
| In reply to | #95720 |
On 16/11/2026 17:02, Charlie Gibbs wrote: > On 2026-11-16, Mike Scott <usenet.16@scottsonline.org.uk.invalid> wrote: > >> GIMP might possibly help? Off the top of my head, import your pdf with >> pages as layers, fiddle with colour, size and resolution, then export >> layers as pages in a pdf. > > That's an interesting possibility. And maybe the Gimp can do some > equivalent of dodging to try to lighten up the shawdowed areas > before converting to monochrome. > Gimp can do all of that, and you can erase smudges etc, but a job of a minute it aint -- There’s a mighty big difference between good, sound reasons and reasons that sound good. Burton Hillis (William Vaughn, American columnist)
[toc] | [prev] | [next] | [standalone]
| From | Rich <rich@example.invalid> |
|---|---|
| Date | 2026-11-16 18:55 +0000 |
| Message-ID | <11dfjia$3qfni$1@dont-email.me> |
| In reply to | #95705 |
Charlie Gibbs <cgibbs@kltpzyxm.invalid> wrote: > Yes, the ultimate solution would to have the person scanning the file > set up appropriate settings. But if that person doesn't know the > fine points of scanning and is at the mercy of Apple (or Microsoft or > whoever), this might not be an option. Yes, the "proper fix" here is to have whomever scanned the original paper do a proper scan from the beginning. Sadly, most normies have no idea and just accept the defaults, and then the scanner software makers further confuse things by doing silly things like making the UI entry for "black and white" actually map to 8-bit grey scale because most folks think of "black and white photos" when they think black & white for a scan, which itself "is" a greyscale image. Actually getting a monochrome scan out of some of the software (esp. the bundled software) can be a royal pain.
[toc] | [prev] | [next] | [standalone]
| From | c186282 <c186282@nnada.net> |
|---|---|
| Date | 2026-11-16 21:29 -0500 |
| Message-ID | <gRqdncJQVYFkJmb3nZ2dnZfqnPudnZ2d@giganews.com> |
| In reply to | #95724 |
On 11/16/26 13:55, Rich wrote: > Charlie Gibbs <cgibbs@kltpzyxm.invalid> wrote: >> Yes, the ultimate solution would to have the person scanning the file >> set up appropriate settings. But if that person doesn't know the >> fine points of scanning and is at the mercy of Apple (or Microsoft or >> whoever), this might not be an option. > > Yes, the "proper fix" here is to have whomever scanned the original > paper do a proper scan from the beginning. Office environment - AIN'T GONNA HAPPEN. Lots of times I got complaints from staff because they couldn't e-mail a letter or PDF. Reason, way WAY too huge. They'd scanned stuff at 2400 or more and just pasted it in. Didn't know how to use, or wouldn't bother to use, image suites to shrink the things down. *I* always had to do it. > Sadly, most normies have no idea and just accept the defaults, and then > the scanner software makers further confuse things by doing silly > things like making the UI entry for "black and white" actually map to > 8-bit grey scale because most folks think of "black and white photos" > when they think black & white for a scan, which itself "is" a greyscale > image. Actually getting a monochrome scan out of some of the software > (esp. the bundled software) can be a royal pain. Also a diff between real, one channel, monochrome and a RGB/CMYK with the color saturation on all channels turned all the way down. 99% of the pop, it it isn't dead easy then it's NOT gonna get done.
[toc] | [prev] | [next] | [standalone]
| From | Nuno Silva <nunojsilva@invalid.invalid> |
|---|---|
| Date | 2026-11-22 11:00 +0000 |
| Message-ID | <11duhvn$qmf8$4@dont-email.me> |
| In reply to | #95724 |
On 2026-11-16, Rich wrote: > Charlie Gibbs <cgibbs@kltpzyxm.invalid> wrote: >> Yes, the ultimate solution would to have the person scanning the file >> set up appropriate settings. But if that person doesn't know the >> fine points of scanning and is at the mercy of Apple (or Microsoft or >> whoever), this might not be an option. > > Yes, the "proper fix" here is to have whomever scanned the original > paper do a proper scan from the beginning. > > Sadly, most normies have no idea and just accept the defaults, and then > the scanner software makers further confuse things by doing silly > things like making the UI entry for "black and white" actually map to > 8-bit grey scale because most folks think of "black and white photos" > when they think black & white for a scan, which itself "is" a greyscale > image. Actually getting a monochrome scan out of some of the software > (esp. the bundled software) can be a royal pain. At least if the problem is that the document has a too high resolution and too many colors, that likely means you might have better input to work with than if it were smaller and bad. Not that it can't be big and still nearly useless, it can... -- Nuno Silva
[toc] | [prev] | [next] | [standalone]
| From | "Carlos E.R." <robin_listas@es.invalid> |
|---|---|
| Date | 2026-11-16 09:47 +0100 |
| Message-ID | <7isqsmxt8e.ln2@Telcontar.valinor> |
| In reply to | #95696 |
On 2026-11-16 00:31, Charlie Gibbs wrote: > Adding the capability to handle multi-page documents uncovered a > few problems. The sizes of the images seem to vary from page to > page, and some some pages have shadows that make it difficult to > make pencil marks visible without getting those big black blotches > I mentioned earlier. If I could persuade the person doing the > scanning to be careful to avoid shadows, my final script should > be able to do a wonderful job of cleaning up such files. This > might not be an option, though - most people seem unable or > unwilling to take the necessary care. At least the images > aren't keystoned... You can script conversion to grayscale instead. And you can downsample, too. -- Cheers, Carlos. ES🇪🇸, EU🇪🇺;
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.os.linux.misc
csiph-web