galfar / deskew

Deskew is a command line tool for deskewing scanned text documents. It uses Hough transform to detect "text lines" in the image. As an output, you get an image rotated so that the lines are horizontal.
http://galfar.vevb.net/deskew
Mozilla Public License 2.0
163 stars 26 forks source link

Bug - -c tg4 seems to incorrectly compress with LZW in windows CLI #54

Closed theretrobristolian closed 8 months ago

theretrobristolian commented 8 months ago

Hey,

I really love the product and am finding it very useful, but I 'think' I've found a bug. the below command compresses in LZW:

deskew.exe -t a -a 10 -b FFFFFF -c tg4 -o C:\IT\Deskewed\MS9-29\MS9-29_page_0007.tif C:\IT\Extracted\MS9-29\MS9-29_page_0007.tif

The input file is compressed with CCITT T.6 so I would expect this to work I believe.

Thanks,

David

galfar commented 8 months ago

Hi,

for now you can add -f b1 argument to force pixel format conversion to 1 bit before saving the output. For rotations after skew detection the program needs to convert to 8 bits per channel (for filtered rotation etc.). When writing the output TIFF it sees G4 would not fit and uses default encoding for 8 bit data.

Makes sense to convert back to binary when G4/CCITT is explicitly requested - user knows what to expect :) Related issue already exists: https://github.com/galfar/deskew/issues/30

Marek

galfar commented 8 months ago

Fixed