FXDDR@ALASKA.BITNET.UUCP (05/16/87)
Date: Fri, 15 May 87 20:40 ADT From: <FXDDR@ALASKA.BITNET> Subject: AIM file format To: info-atari16@score.stanford.edu X-Original-To: "info-atari16@score.stanford.edu", FXDDR I finally had time to check out the AIM image file format. As mentioned previously, the image files are 256x256 pixels, 1 pixel = 1 byte for 256 grey levels. The first byte of the file is the upper left corner. The files look _very_ nice printed on the Apple LaserWriter...perhaps some sufficiently bored programmer will write a program to dump them on a dot matrix printer. Following is a short generic no-frills C program to spit out a PostScript rendition of an AIM image file. Don Rice, FXDDR@ALASKA.BITNET ---Cut here for trivial AIM-to-PS program--- #include stdio main() { int ch, count; FILE *in, *out; if( (in = fopen( "trui.im", "r" )) == NULL ) exit(); if( (out = fopen( "aim.ps", "w" )) == NULL ) exit(); fprintf( out, "\004\n/picstr 256 string def\n" ); fprintf( out, "45 140 translate\n" ); fprintf( out, "504 504 scale\n" ); fprintf( out, "256 256 8\n" ); fprintf( out, "[256 0 0 -256 0 256]\n" ); fprintf( out, "{currentfile\n" ); fprintf( out, " picstr readhexstring pop}\n" ); fprintf( out, "image\n" ); count = 0; while( (ch = fgetc( in )) != EOF ) { fprintf( out, "%02X", (unsigned char) ch ); if( ++count >= 32 ) { fprintf( out, "\n" ); count = 0; } } if( count > 0 ) fprintf( out, "\n" ); fprintf( out, "showpage\n\004\n" ); fclose( out ); fclose( in ); } /* main */ ---End of trivial AIM-to-PS program---