[sane-devel] Generate C source code from a USBSnoopy log
Fri, 24 Jan 2003 23:23:50 +0100
On Fri, Jan 24, 2003 at 01:30:02PM +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.
I think usb-robot is for an older version of snoopy. Tha one wrote
directly to a file instead to that nice window.
> 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 ?).
Well ,that's part of the things you should find out :-) In the hope
that the stream isn't compressed somehow you usually get lines of
data. Either RGBRGB... (or BGRBGR...) or RRRRRR....GGGGG....BBBBB.
That means, pixel-interleaved or line-interleaved.
That was for 8 bit. For 16 or 12 bit it may be more complicated.
> Is there a library I should use for image saving and processing (ImageMagick
> ?). Thank you for your help.
I would just use pnm for testing. Write the header (normal ascii text)
and then just dump the data. See scanimage.c for an example and man
pnm, man ppm, man pgm.