openpaperwork / pyinsane

Python library to access and use image scanners (Linux/Windows/etc) (Sane/WIA) -- Moved to Gnome's Gitlab
https://gitlab.gnome.org/World/OpenPaperwork/pyinsane
63 stars 24 forks source link

Black and White Bits Are Flipped During a Lineart Scan #7

Closed kingmoonracer closed 11 years ago

kingmoonracer commented 11 years ago

I noticed when doing a Lineart scan (called "Binary" for the Epson Workforce 545) the black and white bits were being flipped around (image background was black and the text was white). I changed the order of the bytes under the __raw_1_to_img method in ImgUtil and now black and white are rendered correctly.

jflesch commented 11 years ago

First of all, thanks for this pull request. There is just one point that is bugging me : If they called it "Binary" instead of "Lineart", I have a feeling it may be because of this inversion. In which case, pyinsane should handle "Lineart" as of now, and "Binary" as you suggest. I'll try a "Lineart" scan on my scanner asap. Unfortunately, I won't have time to do that before Sunday, sorry.

kingmoonracer commented 11 years ago

You're welcome. Thanks for the great project :) Yes, you may be right on why they chose to use "Binary". I think just being able to handle in the code whether the mode is Binary or Lineart would be sufficient (.e.g, if Binary then flip the bytes, otherwise leave them).

jflesch commented 11 years ago

Actually, the black and white bits are also reversed with my scanner .... So your patch is fine as is. I'm going to merge it. Thank you very much for your diagnostic and bug fix :)

kingmoonracer commented 11 years ago

Great! You're welcome :)