[sane-devel] Converting Raw Image Data to PNG

Andy Bennett andyjpb at ashurst.eu.org
Mon Jan 13 12:39:12 GMT 2020


Hi,

> Thank you for your responses. I was able to get something! Almost there.
>
> I've attached an image of progress so far. By preapending the 
> "magic pnm code" to the top of the data file I was able to get 
> the raw scan data to display, but not properly. It seems to be 
> separating the images into three sections, seemingly RGB. The 
> sideways slant of the image is also a bit off as I couldn't 
> specify the width with a double.

I think you have the dimensions slightly off, but the width (1296) seems 
correct.
As you say, the image appears slanted and when I try to convert RGBTest.pnm 
to png I get the following:

-----
$ pnmtopng RGBTest.pnm > RGBTest.png
pnmtopng: EOF / read error reading a row of pixels
-----

It looks like there's an extra 5 pixels every 15 lines or so, except for 
every 5 set of 15.

15 lines fit into 20KiB, but 16 do not. I'm not sure if that's relevant at 
all. Perhaps there's some extra framing, checksum or meta data coming in 
from somewhere?


> This leads me to believe the raw data is supposed to be 
> interpreted by some other magic header code. any ideas?
>
> Thanks for your support everyone :)



Best wishes,
@ndy

-- 
andyjpb at ashurst.eu.org
http://www.ashurst.eu.org/
0x7EBA75FF



More information about the sane-devel mailing list