Wie konvertiere ich eine JPEG-Datei in ein schwarzweißes (1-Bit) monochromes TIFF in Ubuntu?

1160
G33K

JPEG ist ein Scan eines Textdokuments, das in Bezug auf Farben / Töne nicht zu verlieren ist.

convert foo.jpg -flatten -monochrome bar.tif

gibt

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

Idealerweise möchte ich die Helligkeit während des Konvertierungsprozesses anpassen.

0
Könnten Sie eine Probe zur Verfügung stellen? Jonno vor 8 Jahren 0
Ich befürchte, es enthält persönliche Daten G33K vor 8 Jahren 0
Ich verstehe, ich habe mich gefragt, ob Sie ein anderes Dokument scannen können, oder haben Sie den Scan nicht gemacht? Jonno vor 8 Jahren 0

1 Antwort auf die Frage

2
Metabolix

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 
Wenn jemand diese Lösung testen möchte, kann das Problem durch Hinzufügen von -compress jpeg nach -monochrome mit jedem Bild reproduziert werden. Metabolix vor 8 Jahren 1