[sane-devel] PIXMA: 1 Bit B/W Lineart for pixma_mp150 and pixma_mp810 Subdrivers

Rolf Bensch rolf at bensch-online.de
Mon Feb 6 16:01:56 UTC 2012


Hello  Ibu,

>
> Hello Rolf,
>
> thanks for the patch. I've tried it with a scanner in the pixma_mp150
> series, Canon MX360, which is however not yet added to pixma_mp150.c,
> and I'm therefore using this patch:

Did you patch your sources or did you fetch the latest version from git?

>
> $ diff sane-backends/backend/pixma_mp150.c
> sane-backends_changed/backend/pixma_mp150.c
> 142a143
>> #define MX360_PID 0x174d
> 1197a1199
>>          s->cfg->pid == MX360_PID ||
> 1589a1592
>>    DEVICE ("Canon PIXMA MX360", "MX360", MX360_PID, 1200, 0, 0, 638,
> 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
>

I just added your scanner to git.

> With this patch my device is working in Gray an Color mode, although I
> didn't manage to catch the ADF out of paper error (which leaves the
> device in an unresponsive state and requires cumbersome restarting;
> maybe somebody could give me a hint?).
>
> Trying your patch in addition to mine, from
>
> SANE_DEBUG_PIXMA=4 /usr/local/bin/scanimage -v -d pixma:04A9174D_XXXXXX
> --resolution 75 --mode Lineart --threshold auto>  /tmp/x.pnm
>
> I get the following output, and scanning stops after part of the page:
>
> ...
> [pixma] pixma_scan(): start
> [pixma]   line_size=640 image_size=70160 channels=1 depth=1

image_size is correct: image_size (lineart) = w * h / 8.

> [pixma]   dpi=75x75 offset=(0,0) dimension=640x877
> [pixma]   gamma_table=0xd7df30 source=0
> [pixma]   threshold=50
> [pixma] ASSERT failed:pixma_common.c:798: s->cur_image_size<=
> s->param->image_size
> [pixma] BUG:ss->image_bytes_read>  ss->sp.image_size
> [pixma] ASSERT failed:pixma_common.c:798: s->cur_image_size<=
> s->param->image_size
> [pixma] pixma_read_image(): cancelled by software
> [pixma] Reader task terminated: ECANCELED
> scanimage: WARNING: read more data than announced by backend (71296/70160)
> [pixma] pixma_close(): Canon PIXMA MX360
>
> If in pixma_common.c instead of
>      sp->image_size /= 8;

This is correct, because the backend calculates 1 byte per pixel and we 
store 1 bit per pixel.

> I try
>      sp->image_size /= 1;
> then the full area is scanned
>

There seems to be a problem somewhere around post_process_image_data in 
pixma_mp150.c. Please use the attached patch to generate log files of 
gray and lineart scans. Please send them packed to avoid an unreadable 
ML archive.

> ...
> [pixma] pixma_scan(): start
> [pixma]   line_size=640 image_size=561280 channels=1 depth=1
> [pixma]   dpi=75x75 offset=(0,0) dimension=640x877
> [pixma]   gamma_table=0x7daf30 source=0
> [pixma]   threshold=50
> [pixma] pixma_read_image():completed
> [pixma] Reader task terminated
> scanimage: WARNING: read more data than announced by backend (561280/70160)
> [pixma] pixma_close(): Canon PIXMA MX360
>
> and the resulting file does obviously contain image data, but the bits
> seem garbled, it is no usable image, while the pbm header seems ok.

If you set "--threshold 90" there should be a usable result.

I need to have a look to gamma. Xsane works fine with threshold.

>
> (
> When I scan in mode Gray it works fine:
>
> [pixma] pixma_scan(): start
> [pixma]   line_size=638 image_size=559526 channels=1 depth=8
> [pixma]   dpi=75x75 offset=(0,0) dimension=638x877
> [pixma]   gamma_table=0x1fbcf30 source=0
> [pixma]   threshold=50
> [pixma] pixma_read_image():completed
> [pixma] Reader task terminated
> scanimage: min/max graylevel value = 38/221
> scanimage: read 559526 bytes in total
> [pixma] pixma_close(): Canon PIXMA MX360
> )
>
> (I also tried with an old version of xsane, with similar results.)

xsane 0.996 works fine for me.

>
> Regards,
> ibu
>

Cheers,
Rolf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pixma_mp150.c.diff
Type: text/x-patch
Size: 1727 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20120206/286efee9/attachment.bin>


More information about the sane-devel mailing list