Re: Question regarding PNM-Format (OS/2)

becka@rz.uni-duesseldorf.de
Thu, 9 Apr 1998 11:54:26 +0200 (MET DST)

> When saving images in the PNM-Format with scanimage, there is a little
> string at the beginning of the image file (# SANE data follows).
>
> As this string isn't really neccessary, can it be omitted?

It can. You can patch the sources of scanimage easily, if really necessary.

> It's because some graphic programs (like Impos/2) doesn't like this string
> in the image file. Without those 20 Bytes the images load without problems.

These programs are broken and should be fixed. Almost any program I know
that write PNM put such a string in there.

However we could state that in the README and show how to patch the
scanimage.c file accordingly :

static void
write_pnm_header (SANE_Frame format, int width, int height, int depth)
{
switch (format)
{
case SANE_FRAME_RED:
case SANE_FRAME_GREEN:
case SANE_FRAME_BLUE:
case SANE_FRAME_RGB:
- printf ("P6\n# SANE data follows\n%d %d\n255\n", width, height);
+ printf ("P6\n%d %d\n255\n", width, height);
break;

default:
if (depth == 1)
- printf ("P4\n# SANE data follows\n%d %d\n", width, height);
+ printf ("P4\n%d %d\n", width, height);
else
- printf ("P5\n# SANE data follows\n%d %d\n255\n", width, height);
+ printf ("P5\n%d %d\n255\n", width, height);
break;
}
#ifdef __EMX__ /* OS2 - write in binary mode. */
_fsetmode(stdout, "b");
#endif
}

CU,ANdy

-- 
= Andreas Beck                    |  Email :  <andreas.beck@ggi-project.org> =

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com