Gentoo Archives: gentoo-user

From: nunojsilva@×××××××.pt
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: [OT] Saving an image as black and white
Date: Mon, 01 Mar 2021 12:11:43
Message-Id: s1illj$ep5$1@ciao.gmane.io
In Reply to: [gentoo-user] [OT] Saving an image as black and white by Wols Lists
1 On 2021-03-01, Wols Lists wrote:
2
3 > I've got a bunch of scans, let's assume they're text documents. And
4 > they're rather big ... I want to email them.
5 >
6 > How on earth do I convert them to TRUE b&w documents? At the moment they
7 > are jpegs that weigh in at 3MB, and I guess they're using about 5 bytes
8 > to store all the colour, luminance, whatever, per pixel. But actually,
9 > there's only ONE BIT of information there - whether that pixel is black
10 > or white.
11 >
12 > I'm using imagemagick, but so far all my attempts to strip out the
13 > surplus information have resulted in INcreasing the file size ???
14 >
15 > So basically, how do I save an image as "one bit per pixel" like you'd
16 > think you'd send to a B&W printer?
17 >
18 > Even at 300dpi, I make that 300*300/8 ~= 10KB/in^2 or 800KB of
19 > uncompressed info for a page of A4, not 3MB.
20 >
21 > Cheers,
22 > Wol
23
24 Somebody else might have a better suggestion, or perhaps a better
25 understanding of the JPEG format and of what needs to be tuned, but, for
26 example:
27
28 convert origin.jpg -threshold 70% -monochrome result.jpg
29
30 (And adjust the "-threshold percent" if needed. It might be that you
31 don't need thresholding at all, but if you do, it apparently must go
32 before "-monochrome".)
33
34 (Depending on the receiving end, you could also explore other
35 formats. Here, if the scanned document can be stored in monochrome, I
36 usually use djvu.)
37
38 --
39 Nuno Silva

Replies

Subject Author
Re: [gentoo-user] Re: [OT] Saving an image as black and white Wols Lists <antlists@××××××××××××.uk>