[comp.windows.x] New version of PBMPLUS released.

jef@well.UUCP (Jef Poskanzer) (11/23/89)

A new version of my image conversion / manipulation package is now
ready.

The beta-test version released on 13sep89 brought in a fair number of
bug reports, so this version should be pretty solid.  Also, I've made
some improvements in the area of handling extremely large files:
ppmscale, pnmcat, and pnmflip all operate line-by-line now, instead of
reading in the whole image.  This is mostly the result of one night
spent playing with a 4100x4100 grayscale image of the moon.

Aside from that, the big changes are:
    tifftopbm became tifftopgm, because it now handles grayscale.  It
      also handles both byte orders now.
    The PostScript and X bitmap converters go three times as fast.
    Added picttopbm.
    g3topbm now works, thanks to Paul Haeberli, plus he added pbmtog3.
    The Sun rasterfile converters will now compile on non-Suns, and
      no longer have byte-order problems.
See the CHANGES file for a more complete list.

I've sent shar files off to the comp.sources.misc moderator.  They will
probably show up pretty soon, he tends to give quick turnaround.

For those on the Internet, the package is available via FTP as:
    expo.lcs.mit.edu:contrib/pbmplus.tar.Z
    ftp.ee.lbl.gov:pbmplus.tar.Z
For the MILNET folks who still don't have name servers, the IP addresses
are:
    expo.lcs.mit.edu		18.30.0.212
    ftp.ee.lbl.gov		128.3.254.68
Don't forget to set binary mode when you retrieve it, and please don't
FTP during working hours (9 am to 6 pm).  This version will probably
also show up in the X.V11R4 release -- I'm pretty sure I met all their
requirements.

I have appended a list of all the formats currently supported.  Enjoy.
---
Jef

  Jef Poskanzer  jef@well.sf.ca.us  {ucbvax, apple, hplabs}!well!jef
      You are in a maze of twisted image formats, all different.

- - - - - - - - - -

PBM handles the following formats:

    Sun icon file				reading	writing
    Sun raster file				reading	writing
    X10 and X11 bitmap file			reading	writing
    MacPaint					reading	writing
    CMU window manager format			reading	writing
    MGR format					reading	writing
    Group 3 FAX					reading	writing
    X11 window dump file			reading	writing
    X10 window dump file			reading
    Xerox doodle brushes			reading
    GEM .img format				reading
    PC paintbrush (.pcx) format			reading
    PICT					reading
    ASCII graphics					writing
    HP LaserJet format					writing
    GraphOn graphics					writing
    BBN BitGraph graphics				writing
    Printronix format					writing

PGM handles the following formats:

    TIFF					reading
    Usenix FaceSaver file			reading
    HIPS					reading
    FITS					reading	writing
    PostScript "image" data			reading
    raw grayscale bytes				reading
    Encapsulated PostScript				writing

PPM handles the following formats:

    color Sun raster file			reading	writing
    GIF						reading	writing
    Amiga IFF ILBM				reading	writing
    color X11 window dump file			reading	writing
    color X10 window dump file			reading
    MTV ray-tracer output			reading
    QRT ray-tracer output			reading
    TrueVision Targa file			reading
    Img-whatnot file				reading
    color Encapsulated PostScript			writing

battle@alphard.cs.utk.edu (David Battle) (11/29/89)

I am having trouble using PBMPLUS on a DECstation 3100.  In particular
I am trying to make a dump of a color (8 bits/pixel) window and change
it to a portable pixmap.  Here is the error I get:

battle> xwd | xwdtoppm > bitmap.out
xwdtoppm: unknown XWD file version: 117440512

I am using the version of xwd which came with the X.V11R3 distribution
from MIT.

What am I doing wrong?

						-David Battle
						battle@utkux1.utk.edu
						battle@battle.esd.ornl.gov

jef@well.UUCP (Jef Poskanzer) (11/29/89)

In the referenced message, battle@alphard.cs.utk.edu (David Battle) wrote:
}I am having trouble using PBMPLUS on a DECstation 3100.  In particular
}I am trying to make a dump of a color (8 bits/pixel) window and change
}it to a portable pixmap.  Here is the error I get:
}battle> xwd | xwdtoppm > bitmap.out
}xwdtoppm: unknown XWD file version: 117440512

You're not doing anything wrong.  The xwd readers and writers have
never handled little-endian machines, unfortunately.  Since I don't
have access to any little-endians running X, it's hard for me to fix
them.  I don't suppose DEC would like to donate a pmax with a color
frame buffer to LBL/RTSG...?  (I'm semi serious about this.  I'm sure
Van Jacobson could use one for his network research.)

Anyway, if I do come up with a fix, I will certainly post a (shudder)
second patch.
---
Jef

     Jef Poskanzer  jef@well.sf.ca.us  {ucbvax, apple, hplabs}!well!jef
"There is no good or bad substance, only good or bad use." -- Thomas Aquinas

battle@alphard.cs.utk.edu (David Battle) (11/29/89)

In article <1408@utkcs2.cs.utk.edu> battle@alphard.cs.utk.edu (I) write:
>I am having trouble using PBMPLUS on a DECstation 3100.  In particular
>I am trying to make a dump of a color (8 bits/pixel) window and change
>it to a portable pixmap.  Here is the error I get:
>
>battle> xwd | xwdtoppm > bitmap.out
>xwdtoppm: unknown XWD file version: 117440512
>
>I am using the version of xwd which came with the X.V11R3 distribution
>from MIT.
>
>What am I doing wrong?
>
>						-David Battle
>						battle@utkux1.utk.edu
>						battle@battle.esd.ornl.gov

Note that 117440512 in hex is 07000000 and that the "correct" xwd version
number is 7.  Obviously a byte ordering problem.  Oddly enough this particular
bug seems to have resulted from a bug in DEC's optimizer (at least it went
away when I removed -O from the CCFLAGS).

I discovered another bug which appears to be with the code itself.  In
xwdtoppm.c around line 250 the code reads:

        /* Read X11 colormap. */
        for ( i = 0; i < h11P->colormap_entries; i++ )
            {
            if ( fread( &x11col, sizeof(X11XColor), 1, file ) != 1 )
                pm_error( "couldn't read X11 XWD colormap", 0,0,0,0,0 );
            /**** 1 ****/
            if ( *maxvalP != 65535 )
                {
                x11col.red = (long) x11col.red * *maxvalP / 65535;
                x11col.green = (long) x11col.green * *maxvalP / 65535;
                x11col.blue = (long) x11col.blue * *maxvalP / 65535;
                }
            PPM_ASSIGN(
                colors[x11col.pixel], x11col.red, x11col.green, x11col.blue );
            }


Most likely, the following code should be inserted at the line which I
have marked /**** 1 ****/:

if(byte_swap) {
    x11col.pixel = bs_long(x11col.pixel);
    x11col.red = bs_short(x11col.red);
    x11col.green = bs_short(x11col.green);
    x11col.blue = bs_short(x11col.blue);
}

This seems to have fixed the other problems I was having.

					-David