Gentoo Archives: gentoo-user

From: Wols Lists <antlists@××××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] Saving an image as black and white
Date: Mon, 01 Mar 2021 15:14:52
Message-Id: 603D0E24.405@youngman.org.uk
In Reply to: Re: [gentoo-user] [OT] Saving an image as black and white by Neil Bothwick
1 On 01/03/21 13:48, Neil Bothwick wrote:
2 > On Mon, 1 Mar 2021 11:50:35 +0000, Wols Lists wrote:
3 >
4 >> I've got a bunch of scans, let's assume they're text documents. And
5 >> they're rather big ... I want to email them.
6 >>
7 >> How on earth do I convert them to TRUE b&w documents? At the moment they
8 >> are jpegs that weigh in at 3MB, and I guess they're using about 5 bytes
9 >> to store all the colour, luminance, whatever, per pixel. But actually,
10 >> there's only ONE BIT of information there - whether that pixel is black
11 >> or white.
12 >>
13 >> I'm using imagemagick, but so far all my attempts to strip out the
14 >> surplus information have resulted in INcreasing the file size ???
15 >>
16 >> So basically, how do I save an image as "one bit per pixel" like you'd
17 >> think you'd send to a B&W printer?
18 >
19 > $ convert input.jpg -threshold 50% output.png
20 >
21 > should do it, you may need to play with the threshold setting. The file
22 > command reports the output file as being "1-bit grayscale".
23 >
24 > You can also use -monochrome but that will produce a dithered image,
25 > that's probably not what you want judging by your description.
26 >
27 >
28 FINALLY!
29
30 Thanks, that worked! Okay, I also adjusted the dpi because the original
31 scan was 600 and I've reduced it to 300, but this has reduced the file
32 size from 3MB to 180KB.
33
34 Dunno why, but everything I was trying was INcreasing the file size :-(
35
36 And the png does make a massive difference - the same command with jpg
37 output is 1.7MB - so why is my scanner chucking out 800KB jpegs if I set
38 it correctly?
39
40 Cheers,
41 Wol

Replies

Subject Author
Re: [gentoo-user] [OT] Saving an image as black and white Rich Freeman <rich0@g.o>
Re: [gentoo-user] [OT] Saving an image as black and white Frank Steinmetzger <Warp_7@×××.de>