Gentoo Archives: gentoo-user

From: William Kenworthy <billk@×××××××××.au>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: [OT] Saving an image as black and white
Date: Mon, 01 Mar 2021 13:25:41
Message-Id: ec092c7f-64ef-7558-1eb5-cf166a805d94@iinet.net.au
In Reply to: Re: [gentoo-user] Re: [OT] Saving an image as black and white by Wols Lists
1 save/convert to pdf - use gs from ghostscrpit to convert them (I use
2 ebook for the target) which gives 10-20x reduction in size with only a
3 small reduction in quality - perfect for emailing.
4
5 I dont have the actual command string but I originally found the
6 suggestion via google.
7
8 BillK
9
10
11 On 1/3/21 9:17 pm, Wols Lists wrote:
12 > On 01/03/21 12:11, (Nuno Silva) wrote:
13 >> On 2021-03-01, Wols Lists wrote:
14 >>
15 >>> I've got a bunch of scans, let's assume they're text documents. And
16 >>> they're rather big ... I want to email them.
17 >>>
18 >>> How on earth do I convert them to TRUE b&w documents? At the moment they
19 >>> are jpegs that weigh in at 3MB, and I guess they're using about 5 bytes
20 >>> to store all the colour, luminance, whatever, per pixel. But actually,
21 >>> there's only ONE BIT of information there - whether that pixel is black
22 >>> or white.
23 >>>
24 >>> I'm using imagemagick, but so far all my attempts to strip out the
25 >>> surplus information have resulted in INcreasing the file size ???
26 >>>
27 >>> So basically, how do I save an image as "one bit per pixel" like you'd
28 >>> think you'd send to a B&W printer?
29 >>>
30 >>> Even at 300dpi, I make that 300*300/8 ~= 10KB/in^2 or 800KB of
31 >>> uncompressed info for a page of A4, not 3MB.
32 >>>
33 >>> Cheers,
34 >>> Wol
35 >> Somebody else might have a better suggestion, or perhaps a better
36 >> understanding of the JPEG format and of what needs to be tuned, but, for
37 >> example:
38 >>
39 >> convert origin.jpg -threshold 70% -monochrome result.jpg
40 >>
41 >> (And adjust the "-threshold percent" if needed. It might be that you
42 >> don't need thresholding at all, but if you do, it apparently must go
43 >> before "-monochrome".)
44 >>
45 >> (Depending on the receiving end, you could also explore other
46 >> formats. Here, if the scanned document can be stored in monochrome, I
47 >> usually use djvu.)
48 >>
49 > Thanks but no, I've already tried that. It makes matters worse!
50 >
51 > I've messed about with the scanner, so it is now creating 800KB images,
52 > but I don't want to rescan everything I've done.
53 >
54 > The problem is that it is clearly saving the images as greyscale, not as
55 > black&white. And when I search for help, what I want is swamped by all
56 > the false positives for greyscale.
57 >
58 > Oh - and for Nuno - sorry tesseract is no use, they are NOT text. That's
59 > why I used the word "assume" - to make it clear that I want a
60 > 1-bit/pixel palette, not a 5-byte/pixel greyscale.
61 >
62 > Cheers,
63 > Wol
64 >