How do I convert a JPEG file into a black and white (1-bit) monochrome TIFF in Ubuntu?

0

JPEG is a scan of a text document so not much to loose in terms of colour/tones.

convert foo.jpg -flatten -monochrome bar.tif

gives

convert: BitsPerSample 1 not allowed for JPEG. 'JPEGSetupEncode' @ error/tiff.c/TIFFErrors/496.

Ideally I would want to adjust brightness during conversion process.

G33K

Posted 2016-01-16T15:33:29.543

Reputation: 101

Could you provide a sample? – Jonno – 2016-01-16T15:38:52.037

I am afraid it has personal data on it – G33K – 2016-01-16T15:49:30.823

I understand, I wondered if you could scan another document, or did you not make the scan? – Jonno – 2016-01-16T15:50:19.663

Answers

2

TIFF files can hold JPEG data, and ImageMagick is trying to save your image as a monochrome JPEG (inside the TIFF), which is not possible.

Add +compress or -compress lzw in your command to force other format:

convert foo.jpg -flatten -monochrome +compress bar.tif
convert foo.jpg -flatten -monochrome -compress lzw bar.tif

Metabolix

Posted 2016-01-16T15:33:29.543

Reputation: 344

1If someone wishes to test this solution, the problem can be reproduced with any image by adding -compress jpeg after -monochrome. – Metabolix – 2016-01-16T15:58:05.260