[sane-devel] Generate C source code from a USBSnoopy log
Bertrik Sikken
bertrik@zonnet.nl
Sat, 25 Jan 2003 12:01:17 +0100
Thomas Soumarmon wrote:
>I have been playing around with my HP5470c scanner for some days without any
>good results. I tried to handwrite C code corresponding to USBSnoopy logs I
>got before as the logs are a bit long and tough, it never worked fully. So I
>decided to replay the log with usb-robot. Logs did not fit with the expected
>syntax... annoying.
>So I decided to write an awk program that would write for me the C sourcecode
>that replays the log, and it works.
>Now I'll need to add the code to write the image to a file. Could anybody tell
>me which format should I expect for the image (RGB pixels from top left ?).
>
I found that for the HP ScanJet 3300, image data is delivered like this:
one line of red data, one line of green data, one line of blue data.
To make it more complicated, the red, green and blue lines are
out-of-sync vertically, meaning that the scanner delivers it like this:
* red data of line 1, green data of line 2, blue data of line 3
* red data of line 2, green data of line 3, blue data of line 4
* red data of line 3, green data of line 4, blue data of line 5
etcetera
And also it turned out for the hp3300 that the image was mirrored
left-to-right, but this is straightforward to correct.
SANE and the pnm format require the data to be delivered in R,G,B per pixel.
>Is there a library I should use for image saving and processing (ImageMagick
>?). Thank you for your help.
>
For the hp3300 testtool I used the pnm file format.
A pnm file is very easy to create, just a text header followed
by raw RGB data. I then used gimp to view the result.
Bertrik