v13i028: ImageMagick - Graphics display programs, Part12/21

cristy at dupont.com cristy at dupont.com
Fri May 24 13:19:07 AEST 1991


Submitted-by: cristy at dupont.com
Posting-number: Volume 13, Issue 28
Archive-name: imagemagic/part12

#!/bin/sh
# this is img.12 (part 12 of ImageMagick)
# do not concatenate these parts, unpack them in order with /bin/sh
# file ImageMagick/filters/Makefile continued
#
if test ! -r _shar_seq_.tmp; then
	echo 'Please unpack part 1 first!'
	exit 1
fi
(read Scheck
 if test "$Scheck" != 12; then
	echo Please unpack part "$Scheck" next!
	exit 1
 else
	exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
	echo 'x - still skipping ImageMagick/filters/Makefile'
else
echo 'x - continuing file ImageMagick/filters/Makefile'
sed 's/^X//' << 'SHAR_EOF' >> 'ImageMagick/filters/Makefile' &&
X
clean::
X	$(RM) TIFFtoMIFF
X
install:: TIFFtoMIFF
X	$(INSTALL) -c $(INSTPGMFLAGS)   TIFFtoMIFF $(BINDIR)
X
MIFFtoTIFF: $(MIFFtoTIFFObjects)
X	$(RM) $@
X	$(CC) -o $@ $(MIFFtoTIFFObjects) $(LDOPTIONS) $(TIFF_LIBRARIES) $(LDLIBS)   $(EXTRA_LOAD_FLAGS)
X
clean::
X	$(RM) MIFFtoTIFF
X
install:: MIFFtoTIFF
X	$(INSTALL) -c $(INSTPGMFLAGS)   MIFFtoTIFF $(BINDIR)
X
depend::
X	$(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
X
image.o:
X	$(CC) $(CFLAGS) -c ../image.c
X
kolb.o:
X	$(CC) $(CFLAGS) -c ../kolb.c
X
quantize.o:
X	$(CC) $(CFLAGS) -c ../quantize.c
X
colors.o:
X	$(CC) $(CFLAGS) -c ../colors.c
X
compress.o:
X	$(CC) $(CFLAGS) -c ../compress.c
X
###########################################################################
# common rules for all Makefiles - do not edit
X
emptyrule::
X
clean::
X	$(RM_CMD) \#*
X
Makefile::
X	- at if [ -f Makefile ]; then \
X	echo "	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
X	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
X	else exit 0; fi
X	$(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
X
tags::
X	$(TAGS) -w *.[ch]
X	$(TAGS) -xw *.[ch] > TAGS
X
saber:
X	#load $(ALLDEFINES) $(SRCS)
X
osaber:
X	#load $(ALLDEFINES) $(OBJS)
X
###########################################################################
# empty rules for directories that do not have SUBDIRS - do not edit
X
install::
X	@echo "install in $(CURRENT_DIR) done"
X
install.man::
X	@echo "install.man in $(CURRENT_DIR) done"
X
Makefiles::
X
includes::
X
###########################################################################
# dependencies generated by makedepend
X
SHAR_EOF
echo 'File ImageMagick/filters/Makefile is complete' &&
chmod 0755 ImageMagick/filters/Makefile ||
echo 'restore of ImageMagick/filters/Makefile failed'
Wc_c="`wc -c < 'ImageMagick/filters/Makefile'`"
test 14700 -eq "$Wc_c" ||
	echo 'ImageMagick/filters/Makefile: original size 14700, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= ImageMagick/filters/GIFtoMIFF.c ==============
if test -f 'ImageMagick/filters/GIFtoMIFF.c' -a X"$1" != X"-c"; then
	echo 'x - skipping ImageMagick/filters/GIFtoMIFF.c (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting ImageMagick/filters/GIFtoMIFF.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/filters/GIFtoMIFF.c' &&
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%                 IIIII  M   M  PPPP    OOO   RRRR    TTTTT                   %
%                   I    MM MM  P   P  O   O  R   R     T                     %
%                   I    M M M  PPPP   O   O  RRRR      T                     %
%                   I    M   M  P      O   O  R R       T                     %
%                 IIIII  M   M  P       OOO   R  R      T                     % 
%                                                                             %
%                                                                             %
%                     Import GIF image to a MIFF format.                      %
%                                                                             %
%                                                                             %
%                                                                             %
%                           Software Design                                   %
%                             John Cristy                                     %
%                            January  1991                                    %
%                                                                             %
%                                                                             %
%  Copyright 1991 E. I. Dupont de Nemours & Company                           %
%                                                                             %
%  Permission to use, copy, modify, distribute, and sell this software and    %
%  its documentation for any purpose is hereby granted without fee,           %
%  provided that the above Copyright notice appear in all copies and that     %
%  both that Copyright notice and this permission notice appear in            %
%  supporting documentation, and that the name of E. I. Dupont de Nemours     %
%  & Company not be used in advertising or publicity pertaining to            %
%  distribution of the software without specific, written prior               %
%  permission.  E. I. Dupont de Nemours & Company makes no representations    %
%  about the suitability of this software for any purpose.  It is provided    %
%  "as is" without express or implied warranty.                               %
%                                                                             %
%  E. I. Dupont de Nemours & Company disclaims all warranties with regard     %
%  to this software, including all implied warranties of merchantability      %
%  and fitness, in no event shall E. I. Dupont de Nemours & Company be        %
%  liable for any special, indirect or consequential damages or any           %
%  damages whatsoever resulting from loss of use, data or profits, whether    %
%  in an action of contract, negligence or other tortious action, arising     %
%  out of or in connection with the use or performance of this software.      %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
%  Command syntax:
%
%  import [-scene #] image.gif image.miff
%  
%  Specify 'image.gif' as '-' for standard input.  
%  Specify 'image.miff'  as '-' for standard output.
%  
*/
X
#include "display.h"
#include "image.h"
/*
X  01/01/91
X
X  Modified to convert GIF to MIFF image format.
X
X  cristy at dupont.com
*/
/* +-------------------------------------------------------------------+ */
/* | Copyright 1990, David Koblas.                                     | */
/* |   Permission to use, copy, modify, and distribute this software   | */
/* |   and its documentation for any purpose and without fee is hereby | */
/* |   granted, provided that the above copyright notice appear in all | */
/* |   copies and that both that copyright notice and this permission  | */
/* |   notice appear in supporting documentation.  This software is    | */
/* |   provided "as is" without express or implied warranty.           | */
/* +-------------------------------------------------------------------+ */
X
#define  MAXCOLORMAPSIZE    256
X
#define  TRUE  1
#define  FALSE  0
X
#define CM_RED    0
#define CM_GREEN  1
#define CM_BLUE    2
X
#define  MAX_LWZ_BITS    12
X
#define INTERLACE    0x40
#define LOCALCOLORMAP  0x80
#define BitSet(byte, bit)  (((byte) & (bit)) == (bit))
X
#define  ReadOK(file,buffer,len)  (fread(buffer, len, 1, file) != 0)
X
#define LM_to_uint(a,b)      (((b)<<8)|(a))
X
struct {
X  unsigned int  Width;
X  unsigned int  Height;
X  unsigned char  ColorMap[3][MAXCOLORMAPSIZE];
X  unsigned int  BitPixel;
X  unsigned int  ColorResolution;
X  unsigned int  Background;
X  unsigned int  AspectRatio;
} GifScreen;
X
struct {
X  int  transparent;
X  int  delayTime;
X  int  inputFlag;
X  int  disposal;
} Gif89 = { -1, -1, -1, 0 };
X
char
X  *application_name,
X  *input_filename,
X  *output_filename;
X
int  scene;
int  verbose;
int  showComment;
X
static char  usage[] = 
X  "[-verbose] [-comments] [-image N] [-scene N] GIFfile MIFFfile";
X
static void ReadGIF();
static void ReadGIFImage();
static int ReadColorMap();
static int DoExtension();
static int GetDataBlock();
static void Error();
X
void main(argc,argv)
int  argc;
char  **argv;
{
#define Usage(usage)  \
{  \
X  (void) fprintf(stderr,"usage: %s\n",usage);  \
X  exit(1);  \
}
X
X  int    argn;
X  FILE    *in;
X  int    imageNumber;
X
X  application_name=argv[0];
X
X  argn = 1;
X  imageNumber = 1;
X  scene = 0;
X  verbose = FALSE;
X  showComment = FALSE;
X
X  while (argn < argc && argv[argn][0] == '-' && argv[argn][1] != '\0') {
X    if (strncmp(argv[argn], "-verbose", 2)) {
X      verbose = TRUE;
X      showComment = TRUE;
X    } else if (strncmp(argv[argn], "-comments", 2)) {
X      showComment = TRUE;
X    } else if (strncmp(argv[argn], "-image", 2)) {
X      ++argn;
X      if (argn == argc || sscanf(argv[argn], "%d", &imageNumber) != 1)
X        Usage(usage);
X    } else if (strncmp(argv[argn], "-scene", 2)) {
X      ++argn;
X      if (argn == argc || sscanf(argv[argn], "%d", &scene) != 1)
X        Usage(usage);
X    } else {
X      Usage(usage);
X    }
X    ++argn;
X  }
X  input_filename=argv[argn];
X  if (input_filename == (char *) NULL ) 
X    Usage(usage);
X  if (*input_filename == '-') 
X    in=stdin; 
X  else 
X    in=fopen(input_filename,"r");
X  ++argn;
X  output_filename=argv[argn];
X  if (output_filename == (char *) NULL) 
X     Usage(usage);
X  ReadGIF(in, imageNumber);
X  fclose(in);
X  exit(0);
}
X
static void
ReadGIF(fd, imageNumber)
FILE  *fd;
int  imageNumber;
{
X  unsigned char  buf[16];
X  unsigned char  c;
X  unsigned char  localColorMap[3][MAXCOLORMAPSIZE];
X  int    useGlobalColormap;
X  int    bitPixel;
X  int    imageCount = 0;
X  char    version[4];
X
X  if (! ReadOK(fd,buf,6))
X    Error("error reading magic number",(char *) NULL);
X
X  if (strncmp(buf,"GIF",3) != 0)
X    Error("not a GIF file",(char *) NULL);
X
X  strncpy(version, buf + 3, 3);
X  version[3] = '\0';
X
X  if ((strcmp(version, "87a") != 0) && (strcmp(version, "89a") != 0))
X    Error("bad version number, not '87a' or '89a'",(char *) NULL);
X
X  if (! ReadOK(fd,buf,7))
X    Error("failed to read screen descriptor",(char *) NULL);
X
X  GifScreen.Width           = LM_to_uint(buf[0],buf[1]);
X  GifScreen.Height          = LM_to_uint(buf[2],buf[3]);
X  GifScreen.BitPixel        = 2<<(buf[4]&0x07);
X  GifScreen.ColorResolution = (((buf[4]&0x70)>>3)+1);
X  GifScreen.Background      = buf[5];
X  GifScreen.AspectRatio     = buf[6];
X
X  if (BitSet(buf[4], LOCALCOLORMAP)) {  /* Global Colormap */
X    if (ReadColorMap(fd,GifScreen.BitPixel,GifScreen.ColorMap))
X      Error("error reading global colormap",(char *) NULL);
X  }
X
X  if (GifScreen.AspectRatio != 0) {
X    float  r;
X    r = ( (float) GifScreen.AspectRatio + 15.0 ) / 64.0;
X  }
X
X  for (;;) {
X    if (! ReadOK(fd,&c,1))
X      Error("EOF / read error on image data",(char *) NULL);
X
X    if (c == ';') {    /* GIF terminator */
X      if (imageCount < imageNumber)
X        Error("not enough images in the file",(char *) NULL);
X      return;
X    }
X
X    if (c == '!') {   /* Extension */
X      if (! ReadOK(fd,&c,1))
X        Error("OF / read error on extention function code",(char *) NULL);
X      DoExtension(fd, c);
X      continue;
X    }
X
X    if (c != ',') {    /* Not a valid start character */
X      continue;
X    }
X
X    ++imageCount;
X
X    if (! ReadOK(fd,buf,9))
X      Error("couldn't read left/top/width/height",(char *) NULL);
X
X    useGlobalColormap = ! BitSet(buf[8], LOCALCOLORMAP);
X
X    bitPixel = 1<<((buf[8]&0x07)+1);
X
X    if (! useGlobalColormap) {
X      if (ReadColorMap(fd, bitPixel, localColorMap))
X        Error("error reading local colormap",(char *) NULL);
X      ReadGIFImage(fd, LM_to_uint(buf[4],buf[5]),
X          LM_to_uint(buf[6],buf[7]), localColorMap,
X          BitSet(buf[8], INTERLACE), imageCount != imageNumber);
X    } else {
X      ReadGIFImage(fd, LM_to_uint(buf[4],buf[5]),
X          LM_to_uint(buf[6],buf[7]), GifScreen.ColorMap,
X          BitSet(buf[8], INTERLACE), imageCount != imageNumber);
X    }
X
X  }
}
X
static int
ReadColorMap(fd,number,buffer)
FILE    *fd;
int    number;
unsigned char  buffer[3][MAXCOLORMAPSIZE];
{
X  int    i;
X  unsigned char  rgb[3];
X
X  for (i = 0; i < number; ++i) {
X    if (! ReadOK(fd, rgb, sizeof(rgb)))
X      Error("bad colormap",(char *) NULL);
X
X    buffer[CM_RED][i] = rgb[0] ;
X    buffer[CM_GREEN][i] = rgb[1] ;
X    buffer[CM_BLUE][i] = rgb[2] ;
X  }
X  return FALSE;
}
X
static int
DoExtension(fd, label)
FILE  *fd;
int  label;
{
X  static char  buf[256];
X  char    *str;
X
X  switch (label) {
X  case 0x01:    /* Plain Text Extension */
X    str = "Plain Text Extension";
#ifdef notdef
X    if (GetDataBlock(fd, buf) == 0)
X      ;
X
X    lpos   = LM_to_uint(buf[0], buf[1]);
X    tpos   = LM_to_uint(buf[2], buf[3]);
X    width  = LM_to_uint(buf[4], buf[5]);
X    height = LM_to_uint(buf[6], buf[7]);
X    cellw  = buf[8];
X    cellh  = buf[9];
X    foreground = buf[10];
X    background = buf[11];
X
X    while (GetDataBlock(fd, buf) != 0) {
X      PPM_ASSIGN(image[ypos][xpos],
X          cmap[CM_RED][v],
X          cmap[CM_GREEN][v],
X          cmap[CM_BLUE][v]);
X      ++index;
X    }
X
X    return FALSE;
#else
X    break;
#endif
X  case 0xff:    /* Application Extension */
X    str = "Application Extension";
X    break;
X  case 0xfe:    /* Comment Extension */
X    str = "Comment Extension";
X    while (GetDataBlock(fd, buf) != 0) {
X      if (showComment)
X        printf("gif comment: %s", buf);
X    }
X    return FALSE;
X  case 0xf9:    /* Graphic Control Extension */
X    str = "Graphic Control Extension";
X    (void) GetDataBlock(fd, buf);
X    Gif89.disposal    = (buf[0] >> 2) & 0x7;
X    Gif89.inputFlag   = (buf[0] >> 1) & 0x1;
X    Gif89.delayTime   = LM_to_uint(buf[1],buf[2]);
X    if ((buf[0] & 0x1) != 0)
X      Gif89.transparent = buf[3];
X
X    while (GetDataBlock(fd, buf) != 0)
X      ;
X    return FALSE;
X  default:
X    str = buf;
X    sprintf(buf, "UNKNOWN (0x%02x)", label);
X    break;
X  }
X
X  while (GetDataBlock(fd, buf) != 0)
X    ;
X
X  return FALSE;
}
X
int  ZeroDataBlock = FALSE;
X
static int
GetDataBlock(fd, buf)
FILE    *fd;
unsigned char   *buf;
{
X  unsigned char  count;
X
X  if (! ReadOK(fd,&count,1)) {
X    Warning("error in getting DataBlock size",(char *) NULL);
X    return -1;
X  }
X
X  ZeroDataBlock = count == 0;
X
X  if ((count != 0) && (! ReadOK(fd, buf, count))) {
X    Warning("error in reading DataBlock",(char *) NULL);
X    return -1;
X  }
X
X  return count;
}
X
static int
GetCode(fd, code_size, flag)
FILE  *fd;
int  code_size;
int  flag;
{
X  static unsigned char  buf[280];
X  static int    curbit, lastbit, done, last_byte;
X  int      i, j, ret;
X  unsigned char    count;
X
X  if (flag) {
X    curbit = 0;
X    lastbit = 0;
X    done = FALSE;
X    return 0;
X  }
X
X  if ( (curbit+code_size) >= lastbit) {
X    if (done) {
X      if (curbit >= lastbit)
X        Error("ran off the end of my bits",(char *) NULL);
X      return -1;
X    }
X    buf[0] = buf[last_byte-2];
X    buf[1] = buf[last_byte-1];
X
X    if ((count = GetDataBlock(fd, &buf[2])) == 0)
X      done = TRUE;
X
X    last_byte = 2 + count;
X    curbit = (curbit - lastbit) + 16;
X    lastbit = (2+count)*8 ;
X  }
X
X  ret = 0;
X  for (i = curbit, j = 0; j < code_size; ++i, ++j)
X    ret |= ((buf[ i / 8 ] & (1 << (i % 8))) != 0) << j;
X
X  curbit += code_size;
X
X  return ret;
}
X
static int
LWZReadByte(fd, flag, input_code_size)
FILE  *fd;
int  flag;
int  input_code_size;
{
X  static int  fresh = FALSE;
X  int    code, incode;
X  static int  code_size, set_code_size;
X  static int  max_code, max_code_size;
X  static int  firstcode, oldcode;
X  static int  clear_code, end_code;
X  static int  table[2][(1<< MAX_LWZ_BITS)];
X  static int  stack[(1<<(MAX_LWZ_BITS))*2], *sp;
X  register int  i;
X
X  if (flag) {
X    set_code_size = input_code_size;
X    code_size = set_code_size+1;
X    clear_code = 1 << set_code_size ;
X    end_code = clear_code + 1;
X    max_code_size = 2*clear_code;
X    max_code = clear_code+2;
X
X    GetCode(fd, 0, TRUE);
X    
X    fresh = TRUE;
X
X    for (i = 0; i < clear_code; ++i) {
X      table[0][i] = 0;
X      table[1][i] = i;
X    }
X    for (; i < (1<<MAX_LWZ_BITS); ++i)
X      table[0][i] = table[1][0] = 0;
X
X    sp = stack;
X
X    return 0;
X  } else if (fresh) {
X    fresh = FALSE;
X    do {
X      firstcode = oldcode =
X        GetCode(fd, code_size, FALSE);
X    } while (firstcode == clear_code);
X    return firstcode;
X  }
X
X  if (sp > stack)
X    return *--sp;
X
X  while ((code = GetCode(fd, code_size, FALSE)) >= 0) {
X    if (code == clear_code) {
X      for (i = 0; i < clear_code; ++i) {
X        table[0][i] = 0;
X        table[1][i] = i;
X      }
X      for (; i < (1<<MAX_LWZ_BITS); ++i)
X        table[0][i] = table[1][i] = 0;
X      code_size = set_code_size+1;
X      max_code_size = 2*clear_code;
X      max_code = clear_code+2;
X      sp = stack;
X      firstcode = oldcode =
X          GetCode(fd, code_size, FALSE);
X      return firstcode;
X    } else if (code == end_code) {
X      int    count;
X      unsigned char  buf[260];
X
X      if (ZeroDataBlock)
X        return -2;
X
X      while ((count = GetDataBlock(fd, buf)) > 0)
X        ;
X
X      if (count != 0)
X        Warning("missing EOD in data stream (common occurance)",(char *) NULL);
X      return -2;
X    }
X
X    incode = code;
X
X    if (code >= max_code) {
X      *sp++ = firstcode;
X      code = oldcode;
X    }
X
X    while (code >= clear_code) {
X      *sp++ = table[1][code];
X      if (code == table[0][code])
X        Error("circular table entry BIG ERROR",(char *) NULL);
X      code = table[0][code];
X    }
X
X    *sp++ = firstcode = table[1][code];
X
X    if ((code = max_code) <(1<<MAX_LWZ_BITS)) {
X      table[0][code] = oldcode;
X      table[1][code] = firstcode;
X      ++max_code;
X      if ((max_code >= max_code_size) &&
X        (max_code_size < (1<<MAX_LWZ_BITS))) {
X        max_code_size *= 2;
X        ++code_size;
X      }
X    }
X
X    oldcode = incode;
X
X    if (sp > stack)
X      return *--sp;
X  }
X  return code;
}
X
static void
ReadGIFImage(fd, len, height, cmap, interlace, ignore)
FILE  *fd;
int  len, height;
char  cmap[3][MAXCOLORMAPSIZE];
int  interlace, ignore;
{
X  unsigned char  c;  
X  int    v;
X  int    xpos = 0, ypos = 0, pass = 0;
X  unsigned char  
X    *image;
X
X  /*
X  **  Initialize the Compression routines
X  */
X  if (! ReadOK(fd,&c,1))
X    Error("EOF / read error on image data",(char *) NULL);
X
X  if (LWZReadByte(fd, TRUE, c) < 0)
X    Error("error reading image",(char *) NULL);
X
X  /*
X  **  If this is an "uninteresting picture" ignore it.
X  */
X  if (ignore) {
X    if (verbose)
X      Warning("skipping image...",(char *) NULL);
X
X    while (LWZReadByte(fd, FALSE, c) >= 0)
X      ;
X    return;
X  }
X
X  if ((image = (unsigned char *) malloc(len* height)) == NULL)
X    Error("couldn't alloc space for image",(char *) NULL);
X
X  while ((v = LWZReadByte(fd,FALSE,c)) >= 0 ) {
X    image[ypos*len+xpos]=v;
X
X    ++xpos;
X    if (xpos == len) {
X      xpos = 0;
X      if (interlace) {
X        switch (pass) {
X        case 0:
X        case 1:
X          ypos += 8; break;
X        case 2:
X          ypos += 4; break;
X        case 3:
X          ypos += 2; break;
X        }
X
X        if (ypos >= height) {
X          ++pass;
X          switch (pass) {
X          case 1:
X            ypos = 4; break;
X          case 2:
X            ypos = 2; break;
X          case 3:
X            ypos = 1; break;
X          }
X        }
X      } else {
X        ++ypos;
X      }
X    }
X  }
X
X  if (verbose)
X    Warning("writing output",(char *) NULL);
X  GIFtoMIFF(cmap,image,len,height);
}
X
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   E r r o r                                                                 %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Function Error displays an error message and then terminates the program.
%
%  The format of the Error routine is:
%
%      Error(message,qualifier)
%
%  A description of each parameter follows:
%
%    o message:  Specifies the message to display before terminating the
%      program.
%
%    o qualifier:  Specifies any qualifier to the message.
%
%
*/
static void Error(message,qualifier)
char
X  *message,
X  *qualifier;
{
X  (void) fprintf(stderr,"%s: %s",application_name,message); 
X  if (qualifier != (char *) NULL)
X    (void) fprintf(stderr," %s",qualifier);
X  (void) fprintf(stderr,".\n");
X  exit(1);
}
/*
X  Write MIFF format.
*/
GIFtoMIFF(colormap,pixels,width,height)
char  
X  colormap[3][MAXCOLORMAPSIZE];
X
unsigned char
X  *pixels;
X
unsigned int
X  width,
X  height;
{
X  register int
X    i;
X
X  Image
X    image;
X
X  register RunlengthPacket
X    *q;
X
X  unsigned char
X    blue,
X    green,
X    red;
X
X  unsigned short
X    index;
X
X  /*
X    Initialize image header.
X  */
X  if (strcmp(output_filename,"-") == 0)
X    (void) strcpy(image.filename,"-");
X  else
X    (void) strcpy(image.filename,output_filename);
X  image.class=PseudoClass;
X  image.compression=RunlengthEncodedCompression;
X  image.comments=(char *) NULL;
X  image.scene=scene;
X  image.columns=width;
X  image.rows=height;
X  image.colors=MAXCOLORMAPSIZE;
X  /*
X    Allocate memory.
X  */
X  image.comments=(char *) malloc((unsigned int) (strlen(image.filename)+256));
X  image.colormap=(ColorPacket *) malloc(image.colors*sizeof(ColorPacket));
X  image.pixels=(RunlengthPacket *) 
X    malloc(image.columns*image.rows*sizeof(RunlengthPacket));
X  if ((image.comments == (char *) NULL) ||
X      (image.colormap == (ColorPacket *) NULL) ||
X      (image.pixels == (RunlengthPacket *) NULL))
X    {
X      (void) fprintf(stderr,"Can't import GIF image, not enough memory.\n");
X      exit(1);
X    }
X  /*
X    Initialize comments, colormap, and pixel data.
X  */
X  (void) sprintf(image.comments,"\n  Imported from GIF image:  %s\n\0",
X    input_filename);
X  for (i=0; i < image.colors; i++)
X  {
X    image.colormap[i].red=colormap[CM_RED][i];
X    image.colormap[i].green=colormap[CM_GREEN][i];
X    image.colormap[i].blue=colormap[CM_BLUE][i];
X  }
X  image.packets=0;
X  q=image.pixels;
X  q->length=MaxRunlength;
X  for (i=0; i < (image.columns*image.rows); i++)
X  {
X    index=pixels[i];
X    red=image.colormap[index].red;
X    green=image.colormap[index].green;
X    blue=image.colormap[index].blue;
X    if ((red == q->red) && (green == q->green) && (blue == q->blue) &&
X        (q->length < MaxRunlength))
X      q->length++;
X    else
X      {
X        if (image.packets > 0)
X          q++;
X        image.packets++;
X        q->red=red;
X        q->green=green;
X        q->blue=blue;
X        q->index=index;
X        q->length=0;
X      }
X  }
X  if (image.packets > ((image.columns*image.rows*3) >> 2))
X    image.compression=NoCompression;
X  WriteImage(&image);
X  (void) free((char *) image.pixels);
X  (void) free((char *) image.colormap);
}
SHAR_EOF
chmod 0755 ImageMagick/filters/GIFtoMIFF.c ||
echo 'restore of ImageMagick/filters/GIFtoMIFF.c failed'
Wc_c="`wc -c < 'ImageMagick/filters/GIFtoMIFF.c'`"
test 20330 -eq "$Wc_c" ||
	echo 'ImageMagick/filters/GIFtoMIFF.c: original size 20330, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= ImageMagick/filters/SUNtoMIFF.c ==============
if test -f 'ImageMagick/filters/SUNtoMIFF.c' -a X"$1" != X"-c"; then
	echo 'x - skipping ImageMagick/filters/SUNtoMIFF.c (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting ImageMagick/filters/SUNtoMIFF.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/filters/SUNtoMIFF.c' &&
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%                 IIIII  M   M  PPPP    OOO   RRRR    TTTTT                   %
%                   I    MM MM  P   P  O   O  R   R     T                     %
%                   I    M M M  PPPP   O   O  RRRR      T                     %
%                   I    M   M  P      O   O  R R       T                     %
%                 IIIII  M   M  P       OOO   R  R      T                     % 
%                                                                             %
%                                                                             %
%                 Import SUN raster image to a MIFF format.                   %
%                                                                             %
%                                                                             %
%                                                                             %
%                           Software Design                                   %
%                             John Cristy                                     %
%                            January  1991                                    %
%                                                                             %
%                                                                             %
%  Copyright 1991 E. I. Dupont de Nemours & Company                           %
%                                                                             %
%  Permission to use, copy, modify, distribute, and sell this software and    %
%  its documentation for any purpose is hereby granted without fee,           %
%  provided that the above Copyright notice appear in all copies and that     %
%  both that Copyright notice and this permission notice appear in            %
%  supporting documentation, and that the name of E. I. Dupont de Nemours     %
%  & Company not be used in advertising or publicity pertaining to            %
%  distribution of the software without specific, written prior               %
%  permission.  E. I. Dupont de Nemours & Company makes no representations    %
%  about the suitability of this software for any purpose.  It is provided    %
%  "as is" without express or implied warranty.                               %
%                                                                             %
%  E. I. Dupont de Nemours & Company disclaims all warranties with regard     %
%  to this software, including all implied warranties of merchantability      %
%  and fitness, in no event shall E. I. Dupont de Nemours & Company be        %
%  liable for any special, indirect or consequential damages or any           %
%  damages whatsoever resulting from loss of use, data or profits, whether    %
%  in an action of contract, negligence or other tortious action, arising     %
%  out of or in connection with the use or performance of this software.      %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
%  Command syntax:
%
%  import [-scene #] image.sun image.miff
%  
%  Specify 'image.sun' as '-' for standard input.  
%  Specify 'image.miff' as '-' for standard output.
%  
%
*/
X
#include <string.h>
#include "display.h"
#include "image.h"
X
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   E r r o r                                                                 %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Function Error displays an error message and then terminates the program.
%
%  The format of the Error routine is:
%
%      Error(message,qualifier)
%
%  A description of each parameter follows:
%
%    o message:  Specifies the message to display before terminating the
%      program.
%
%    o qualifier:  Specifies any qualifier to the message.
%
%
*/
void Error(message,qualifier)
char
X  *message,
X  *qualifier;
{
X  (void) fprintf(stderr,"%s: %s",application_name,message); 
X  if (qualifier != (char *) NULL)
X    (void) fprintf(stderr," %s",qualifier);
X  (void) fprintf(stderr,".\n");
X  exit(1);
}
X
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%  M S B F i r s t O r d e r                                                  %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Function MSBFirstOrder converts a least-significant byte first buffer of
%  integers to most-significant byte first.
%
%  The format of the MSBFirstOrder routine is:
%
%       MSBFirstOrder(p,length);
%
%  A description of each parameter follows.
%
%   o  p:  Specifies a pointer to a buffer of integers.
%
%   o  length:  Specifies the length of the buffer.
%
%
*/
MSBFirstOrder(p,length)
register char 
X  *p;
X
register unsigned 
X  length;
{
X  register char 
X    c,
X    *q,
X    *sp;
X
X  q=p+length;
X  while (p < q) 
X  {
X    sp=p+3;
X    c=(*sp);
X    *sp=(*p);
X    *p++=c;
X    sp=p+1;
X    c=(*sp);
X    *sp=(*p);
X    *p++=c;
X    p+=2;
X  }
}
X
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%  R e a d R a s t e r I m a g e                                              %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Function ReadSUNImage reads an image file and returns it.  It allocates 
%  the memory necessary for the new Image structure and returns a pointer to 
%  the new image.
%
%  The format of the ReadSUNImage routine is:
%
%      image=ReadSUNImage(filename)
%
%  A description of each parameter follows:
%
%    o image:  Function ReadSUNImage returns a pointer to the image after 
%      reading.  A null image is returned if there is a a memory shortage or 
%      if the image cannot be read.
%
%    o filename:  Specifies the name of the image to read.
%
%
*/
static Image *ReadSUNImage(filename)
char
X  *filename;
{
#define RMT_EQUAL_RGB  1
#define RMT_NONE  0
#define RMT_RAW  2
#define RT_STANDARD  1
#define RT_FORMAT_RGB  3
X
X  typedef struct _Rasterfile
X  {
X    int
X      magic,
X      width,
X      height,
X      depth,
X      length,
X      type,
X      maptype,
X      maplength;
X  } Rasterfile;
X
X  Image
X    *image;
X
X  Rasterfile
X    sun_header;
X
X  register int
X    bit,
X    i,
X    x,
X    y;
X
X  register RunlengthPacket
X    *q;
X
X  register unsigned char
X    *p;
X
X  unsigned char
X    blue,
X    green,
X    red,
X    *sun_pixels;
X
X  unsigned long 
X    lsb_first;
X
X  unsigned short
X    index;
X
X  /*
X    Allocate image structure.
X  */
X  image=(Image *) malloc(sizeof(Image));
X  if (image == (Image *) NULL)
X    Error("memory allocation error",(char *) NULL);
X  /*
X    Initialize Image structure.
X  */
X  image->id=UnknownId;
X  image->class=DirectClass;
X  image->compression=RunlengthEncodedCompression;
X  image->columns=0;
X  image->rows=0;
X  image->packets=0;
X  image->colors=0;
X  image->scene=0;
X  image->colormap=(ColorPacket *) NULL;
X  image->pixels=(RunlengthPacket *) NULL;
X  image->comments=(char *) NULL;
X  /*
X    Open image file.
X  */
X  (void) strcpy(image->filename,filename);
X  if (*image->filename == '-')
X    image->file=stdin;
X  else
X    if (strcmp(image->filename+strlen(image->filename)-2,".Z") != 0)
X      image->file=fopen(image->filename,"r");
X    else
X      {
X        char
X          command[256];
X
X        /*
X          Image file is compressed-- uncompress it.
X        */
X        (void) sprintf(command,"uncompress -c %s",image->filename);
X        image->file=(FILE *) popen(command,"r");
X      }
X  if (image->file == (FILE *) NULL)
X    Error("unable to open file",image->filename);
X  /*
X    Read raster image.
X  */
X  (void) ReadData((char *) &sun_header,1,sizeof(Rasterfile),image->file);
X  /*
X    Ensure the header byte-order is most-significant byte first.
X  */
X  lsb_first=1;
X  if (*(char *) &lsb_first)
X    MSBFirstOrder((char *) &sun_header,sizeof(sun_header));
X  if (sun_header.magic != 0x59a66a95)
X    Error("not a SUN raster,",image->filename);
X  if ((sun_header.type != RT_STANDARD) && (sun_header.type != RT_FORMAT_RGB))
X    Error("not in standard format,",image->filename);
X  switch (sun_header.maptype)
X  {
X    case RMT_NONE:
X    {
X      if (sun_header.depth < 24)
X        {
X          /*
X            Create linear color ramp.
X          */
X          image->colors=1 << sun_header.depth;
X          image->colormap=(ColorPacket *) 
X            malloc(image->colors*sizeof(ColorPacket));
X          if (image->colormap == (ColorPacket *) NULL)
X            Error("memory allocation error",(char *) NULL);
X          for (i=0; i < image->colors; i++)
X          {
X            image->colormap[i].red=(255*i)/(image->colors-1);
X            image->colormap[i].green=(255*i)/(image->colors-1);
X            image->colormap[i].blue=(255*i)/(image->colors-1);
X          }
X        }
X      break;
X    }
X    case RMT_EQUAL_RGB:
X    {
X      unsigned char
X        *sun_colormap;
X
X      /*
X        Read Sun raster colormap.
X      */
X      image->colors=sun_header.maplength/3;
X      image->colormap=
X        (ColorPacket *) malloc(image->colors*sizeof(ColorPacket));
X      sun_colormap=(unsigned char *) 
X        malloc(image->colors*sizeof(unsigned char));
X      if ((image->colormap == (ColorPacket *) NULL) ||
X          (sun_colormap == (unsigned char *) NULL))
X        Error("memory allocation error",(char *) NULL);
X      (void) ReadData((char *) sun_colormap,1,(int) image->colors,image->file);
X      for (i=0; i < image->colors; i++)
X        image->colormap[i].red=sun_colormap[i];
X      (void) ReadData((char *) sun_colormap,1,(int) image->colors,image->file);
X      for (i=0; i < image->colors; i++)
X        image->colormap[i].green=sun_colormap[i];
X      (void) ReadData((char *) sun_colormap,1,(int) image->colors,image->file);
X      for (i=0; i < image->colors; i++)
X        image->colormap[i].blue=sun_colormap[i];
X      (void) free((char *) sun_colormap);
X      break;
X    }
X    case RMT_RAW:
X    {
X      unsigned char
X        *sun_colormap;
X
X      /*
X        Read Sun raster colormap.
X      */
X      sun_colormap=(unsigned char *) 
X        malloc(sun_header.maplength*sizeof(unsigned char));
X      if (sun_colormap == (unsigned char *) NULL)
X        Error("memory allocation error",(char *) NULL);
X      (void) ReadData((char *) sun_colormap,1,sun_header.maplength,
X        image->file);
X      (void) free((char *) sun_colormap);
X      break;
X    }
X    default:
X    {
X      Error("colormap type is not supported",image->filename);
X      break;
X    }
X  }
X  sun_pixels=(unsigned char *) 
X    malloc((unsigned int) sun_header.length*sizeof(unsigned char));
X  if (sun_pixels == (unsigned char *) NULL)
X    Error("memory allocation error",(char *) NULL);
X  (void) ReadData((char *) sun_pixels,1,sun_header.length,image->file);
X  /*
X    Create image.
X  */
X  image->comments=(char *) malloc((unsigned int) (strlen(image->filename)+256));
X  if (image->comments == (char *) NULL)
X    Error("memory allocation error",(char *) NULL);
X  (void) sprintf(image->comments,"\n  Imported from Sun raster image:  %s\n\0",
X    image->filename);
X  image->class=(sun_header.depth < 24 ? PseudoClass : DirectClass);
X  image->columns=sun_header.width;
X  image->rows=sun_header.height;
X  image->pixels=(RunlengthPacket *) 
X    malloc(image->columns*image->rows*sizeof(RunlengthPacket));
X  if (image->pixels == (RunlengthPacket *) NULL)
X    Error("memory allocation error",(char *) NULL);
X  /*
X    Convert Sun raster image to runlength-encoded packets.
X  */
X  p=sun_pixels;
X  image->packets=0;
X  q=image->pixels;
X  q->length=MaxRunlength;
X  if (sun_header.depth == 1)
X    for (y=0; y < image->rows; y++)
X    {
X      /*
X        Convert bitmap scanline to runlength-encoded color packets.
X      */
X      for (x=0; x < (image->columns >> 3); x++) 
X      {
X        for (bit=7; bit >= 0; bit--)
X        {
X          index=((*p) & (0x01 << bit) ? 0x00 : 0x01);
X          red=image->colormap[index].red;
X          green=image->colormap[index].green;
X          blue=image->colormap[index].blue;
X          if ((red == q->red) && (green == q->green) && (blue == q->blue) &&
X              (q->length < MaxRunlength))
X            q->length++;
X          else
X            {
X              if (image->packets > 0)
X                q++;
X              image->packets++;
X              q->red=red;
X              q->green=green;
X              q->blue=blue;
X              q->index=index;
X              q->length=0;
X            }
X        }
X        p++;
X      }
X      if ((image->columns % 8) != 0)
X        {
X          for (bit=7; bit >= (8-(image->columns % 8)); bit--)
X          {
X            index=((*p) & (0x01 << bit) ? 0x00 : 0x01);
X            red=image->colormap[index].red;
X            green=image->colormap[index].green;
X            blue=image->colormap[index].blue;
X            if ((red == q->red) && (green == q->green) && (blue == q->blue) &&
X                (q->length < MaxRunlength))
X              q->length++;
X            else
X              {
X                if (image->packets > 0)
X                  q++;
X                image->packets++;
X                q->red=red;
X                q->green=green;
X                q->blue=blue;
X                q->index=index;
X                q->length=0;
X              }
X          }
X          p++;
X        }
X    }
X  else
X    if (image->class == PseudoClass)
X      for (y=0; y < image->rows; y++)
X      {
X        /*
X          Convert PseudoColor scanline to runlength-encoded color packets.
X        */
X        for (x=0; x < image->columns; x++) 
X        {
X          index=(*p++);
X          red=image->colormap[index].red;
X          green=image->colormap[index].green;
X          blue=image->colormap[index].blue;
X          if ((red == q->red) && (green == q->green) && (blue == q->blue) &&
X              (q->length < MaxRunlength))
X            q->length++;
X          else
X            {
X              if (image->packets > 0)
X                q++;
X              image->packets++;
X              q->red=red;
X              q->green=green;
X              q->blue=blue;
X              q->index=index;
X              q->length=0;
X            }
X        }
X        if ((image->columns % 2) != 0)
X          p++;
X      }
X    else
X      for (y=0; y < image->rows; y++)
X      {
X        /*
X          Convert DirectColor scanline to runlength-encoded color packets.
X        */
X        for (x=0; x < image->columns; x++) 
X        {
X          if (sun_header.type == RT_STANDARD)
X            {
X              blue=(*p++);
X              green=(*p++);
X              red=(*p++);
X            }
X          else
X            {
X              red=(*p++);
X              green=(*p++);
X              blue=(*p++);
X            }
X          if ((red == q->red) && (green == q->green) && (blue == q->blue) &&
X              (q->length < MaxRunlength))
X              q->length++;
X            else
X              {
X                if (image->packets > 0)
X                  q++;
X                image->packets++;
X                q->red=red;
X                q->green=green;
X                q->blue=blue;
X                q->index=0;
X                q->length=0;
X              }
X        }
X        if ((image->columns % 2) != 0)
X          p++;
X      }
X  (void) free((char *) sun_pixels);
X  if (image->file != stdin)
X    if (strcmp(image->filename+strlen(image->filename)-2,".Z") != 0)
X      (void) fclose(image->file);
X    else
X      (void) pclose(image->file);
X  if (image->packets > ((image->columns*image->rows*3) >> 2))
X    image->compression=NoCompression;
X  image->pixels=(RunlengthPacket *)
X    realloc((char *) image->pixels,image->packets*sizeof(RunlengthPacket));
X  return(image);
}
X
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   U s a g e                                                                 %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Function Usage displays the program usage;
%
%  The format of the Usage routine is:
%
%      Usage(message)
%
%  A description of each parameter follows:
%
%    message:  Specifies a specific message to display to the user.
%
*/
static void Usage(message)
char
X  *message;
{
X  if (message != (char *) NULL)
X    (void) fprintf(stderr,"Can't continue, %s\n\n",message);
X  (void) fprintf(stderr,"Usage: %s [-scene #] image.sun image.miff\n\n",
X    application_name);
X  (void) fprintf(stderr,"Specify 'image.sun' as '-' for standard input.\n");
X  (void) fprintf(stderr,"Specify 'image.miff' as '-' for standard output.\n");
X  exit(1);
}
X
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%  M a i n                                                                    %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
*/
int main(argc,argv)
int
X  argc;
X   
char
X  *argv[];
{
X  char
X    filename[256];
X
X  Image
X    *image;
X
X  int
X    i;
X
X  unsigned int
X    scene;
X
X  /*
X    Initialize program variables.
X  */
X  application_name=argv[0];
X  i=1;
X  scene=0;
X  if (argc < 3)
X    Usage((char *) NULL);
X  /*
X    Read image and convert to MIFF format.
X  */
X  if (strncmp(argv[i],"-scene",2) == 0)
X    {
X      i++;
X      scene=atoi(argv[i++]);
X    }
X  (void) strcpy(filename,argv[i++]);
X  image=ReadSUNImage(filename);
X  if (image == (Image *) NULL)
X    exit(1);
X  (void) strcpy(image->filename,argv[i++]);
X  image->scene=scene;
X  (void) WriteImage(image);
X  (void) fprintf(stderr,"%s => %s  %dx%d\n",filename,image->filename,
X    image->columns,image->rows);
X  DestroyImage(image);
X  return(False);
}
SHAR_EOF
chmod 0755 ImageMagick/filters/SUNtoMIFF.c ||
echo 'restore of ImageMagick/filters/SUNtoMIFF.c failed'
Wc_c="`wc -c < 'ImageMagick/filters/SUNtoMIFF.c'`"
test 20166 -eq "$Wc_c" ||
	echo 'ImageMagick/filters/SUNtoMIFF.c: original size 20166, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= ImageMagick/filters/TIFFtoMIFF.c ==============
if test -f 'ImageMagick/filters/TIFFtoMIFF.c' -a X"$1" != X"-c"; then
	echo 'x - skipping ImageMagick/filters/TIFFtoMIFF.c (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting ImageMagick/filters/TIFFtoMIFF.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/filters/TIFFtoMIFF.c' &&
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%                 IIIII  M   M  PPPP    OOO   RRRR    TTTTT                   %
%                   I    MM MM  P   P  O   O  R   R     T                     %
%                   I    M M M  PPPP   O   O  RRRR      T                     %
%                   I    M   M  P      O   O  R R       T                     %
%                 IIIII  M   M  P       OOO   R  R      T                     % 
%                                                                             %
%                                                                             %
%                    Import TIFF image to a MIFF format.                      %
%                                                                             %
%                                                                             %
%                                                                             %
%                           Software Design                                   %
%                             John Cristy                                     %
%                            January  1991                                    %
%                                                                             %
%                                                                             %
%  Copyright 1991 E. I. Dupont de Nemours & Company                           %
%                                                                             %
%  Permission to use, copy, modify, distribute, and sell this software and    %
%  its documentation for any purpose is hereby granted without fee,           %
%  provided that the above Copyright notice appear in all copies and that     %
%  both that Copyright notice and this permission notice appear in            %
%  supporting documentation, and that the name of E. I. Dupont de Nemours     %
%  & Company not be used in advertising or publicity pertaining to            %
%  distribution of the software without specific, written prior               %
%  permission.  E. I. Dupont de Nemours & Company makes no representations    %
%  about the suitability of this software for any purpose.  It is provided    %
%  "as is" without express or implied warranty.                               %
%                                                                             %
%  E. I. Dupont de Nemours & Company disclaims all warranties with regard     %
%  to this software, including all implied warranties of merchantability      %
%  and fitness, in no event shall E. I. Dupont de Nemours & Company be        %
%  liable for any special, indirect or consequential damages or any           %
%  damages whatsoever resulting from loss of use, data or profits, whether    %
%  in an action of contract, negligence or other tortious action, arising     %
%  out of or in connection with the use or performance of this software.      %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
%  Command syntax:
%
%  import [-scene #] image.tiff image.miff
%  
%  Specify 'image.tiff' as '-' for standard input.  
%  Specify 'image.miff' as '-' for standard output.
% 
%
*/
X
#include <string.h>
#include "display.h"
#include "image.h"
X
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   E r r o r                                                                 %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Function Error displays an error message and then terminates the program.
%
%  The format of the Error routine is:
%
%      Error(message,qualifier)
%
%  A description of each parameter follows:
%
%    o message:  Specifies the message to display before terminating the
%      program.
%
%    o qualifier:  Specifies any qualifier to the message.
%
%
*/
void Error(message,qualifier)
char
X  *message,
X  *qualifier;
{
X  (void) fprintf(stderr,"%s: %s",application_name,message); 
X  if (qualifier != (char *) NULL)
X    (void) fprintf(stderr," %s",qualifier);
X  (void) fprintf(stderr,".\n");
X  exit(1);
}
X
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%  R e a d T i f f I m a g e                                                  %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Function ReadTIFFImage reads an image file and returns it.  It allocates the 
%  memory necessary for the new Image structure and returns a pointer to the 
%  new image.
%
%  The format of the ReadTIFFImage routine is:
%
%      image=ReadTIFFImage(filename)
%
%  A description of each parameter follows:
%
%    o image:  Function ReadTIFFImage returns a pointer to the image after 
%      reading.  A null image is returned if there is a a memory shortage or 
%      if the image cannot be read.
%
%    o filename:  Specifies the name of the image to read.
%
%    o verbose:  A value greater than zero prints detailed information about 
%      the image.
%
%
*/
static Image *ReadTIFFImage(filename,verbose)
char
X  *filename;
X
unsigned int
X  verbose;
{
#include <tiff.h>
#include <tiffio.h>
X
X  Image
X    *image;
X
X  register int
X    i;
X
X  register RunlengthPacket
X    *q;
X
X  register unsigned char
X    *p;
X
X  register unsigned int 
X    x,
X    y;
X
X  register unsigned short
X    index;
X
X  TIFF
X    *file;
X
X  unsigned char
X    blue,
X    green,
X    red,
X    *scanline;
X
X  unsigned short
X    bits_per_sample,
X    fill_order,
X    image_length,
X    image_width,
X    photometric,
X    planar_configuration,
X    samples_per_pixel;
X
X  /*
X    Allocate image structure.
X  */
X  image=(Image *) malloc(sizeof(Image));
X  if (image == (Image *) NULL)
X    Error("unable to allocate memory",(char *) NULL);
X  /*
X    Initialize Image structure.
X  */
X  image->id=UnknownId;
X  image->class=DirectClass;
X  image->compression=RunlengthEncodedCompression;
X  image->columns=0;
X  image->rows=0;
X  image->packets=0;
X  image->colors=0;
X  image->scene=0;
X  image->colormap=(ColorPacket *) NULL;
X  image->pixels=(RunlengthPacket *) NULL;
X  image->comments=(char *) NULL;
X  /*
X    Open TIFF image file.
X  */
X  (void) strcpy(image->filename,filename);
X  file=TIFFOpen(image->filename,"r"); 
X  if (file == (TIFF *) NULL)
X    exit(1);
X  if (verbose)
X    TIFFPrintDirectory(file,stderr,False,False,False);
X  /*
X    Verify this image is acceptable.
X  */
X  if (!TIFFGetField(file,TIFFTAG_BITSPERSAMPLE,&bits_per_sample))
X    bits_per_sample=1;
X  if (!TIFFGetField(file,TIFFTAG_PHOTOMETRIC,&photometric))
X    photometric=PHOTOMETRIC_PALETTE;
X  if ((bits_per_sample > 8) && (photometric != PHOTOMETRIC_RGB))
X    Error("image is more than 8-bits per sample",(char *) NULL);
X  if (!TIFFGetField(file,TIFFTAG_SAMPLESPERPIXEL,&samples_per_pixel))
X    samples_per_pixel=1;
X  if ((samples_per_pixel != 1) && (samples_per_pixel != 3) &&
X      (samples_per_pixel != 4))
X    Error("samples per pixel must be 1, 3, or 4",(char *) NULL);
X  /*
X    Initialize image attributes.
X  */
X  if (!TIFFGetField(file,TIFFTAG_PHOTOMETRIC,&photometric))
X    photometric=PHOTOMETRIC_PALETTE;
X  TIFFGetField(file,TIFFTAG_IMAGEWIDTH,&image_width);
X  TIFFGetField(file,TIFFTAG_IMAGELENGTH,&image_length);
X  image->comments=(char *) malloc((unsigned int) (strlen(image->filename)+256));
X  if (image->comments == (char *) NULL)
X    Error("unable to allocate memory",(char *) NULL);
X  (void) sprintf(image->comments,"\n  Imported from TIFF image %s.\n\0",
X    image->filename);
X  image->class=(photometric == PHOTOMETRIC_RGB ? DirectClass : PseudoClass);
X  image->columns=image_width;
X  image->rows=image_length;
X  image->colors=1 << bits_per_sample;
X  if (image->class == PseudoClass)
X    {
X      /*
X        Prepare for pseudo-color image.
X      */
X      image->colormap=(ColorPacket *) malloc(image->colors*sizeof(ColorPacket));
X      if (image->colormap == (ColorPacket *) NULL)
X        Error("unable to allocate memory",(char *) NULL);
X      /*
X        Create colormap.
X      */
X      switch (photometric)
X      {
X        case PHOTOMETRIC_MINISBLACK:
X        {
X          for (i=0; i < image->colors; i++)
X          {
X            image->colormap[i].red=(255*i)/(image->colors-1);
X            image->colormap[i].green=(255*i)/(image->colors-1);
X            image->colormap[i].blue=(255*i)/(image->colors-1);
X          }
X          break;
X        }
X        case PHOTOMETRIC_MINISWHITE:
X        {
X          for (i=0; i < image->colors; i++)
X          {
X            image->colormap[i].red=255-(255*i)/(image->colors-1);
X            image->colormap[i].green=255-(255*i)/(image->colors-1);
X            image->colormap[i].blue=255-(255*i)/(image->colors-1);
X          }
X          break;
X        }
X        case PHOTOMETRIC_PALETTE:
X        {
X          unsigned short
X            *blue_colormap,
X            *green_colormap,
X            *red_colormap;
X
X          TIFFGetField(file,TIFFTAG_COLORMAP,&red_colormap,&green_colormap,
X            &blue_colormap);
X          for (i=0; i < image->colors; i++)
X          {
X            image->colormap[i].red=red_colormap[i] >> 8;
X            image->colormap[i].green=green_colormap[i] >> 8;
X            image->colormap[i].blue=blue_colormap[i] >> 8;
X          }
X          break;
X        }
X        default:
X          break;
X      }
X    }
X  /*
X    Allocate memory for the image and scanline buffer.
X  */
X  image->pixels=(RunlengthPacket *) 
X    malloc(image->columns*image->rows*sizeof(RunlengthPacket));
X  TIFFGetField(file,TIFFTAG_PLANARCONFIG,&planar_configuration);
X  if (planar_configuration == PLANARCONFIG_CONTIG)
X    scanline=(unsigned char *) malloc((unsigned int) TIFFScanlineSize(file));
X  else
X    scanline=(unsigned char *) 
X      malloc((unsigned int) samples_per_pixel*TIFFScanlineSize(file));
X  if ((image->pixels == (RunlengthPacket *) NULL) ||
X      (scanline == (unsigned char *) NULL))
X    Error("unable to allocate memory",(char *) NULL);
X  /*
X    Read the TIFF image and write to image pixel buffer.
X  */
X  if (!TIFFGetField(file,TIFFTAG_FILLORDER,&fill_order))
X    fill_order=FILLORDER_MSB2LSB;
X  image->packets=0;
X  q=image->pixels;
X  q->length=MaxRunlength;
X  for (y=0; y < image->rows; y++)
X  {
X    p=scanline;
X    if (TIFFReadScanline(file,p,y,0) < 0)
X      Error("unable to read TIFF scanline",(char *) NULL);
X    if (planar_configuration != PLANARCONFIG_CONTIG)
X      for (i=1; i < samples_per_pixel; i++)
X        if (TIFFReadScanline(file,p+i*TIFFScanlineSize(file),y,i) < 0)
X          Error("unable to read TIFF scanline",(char *) NULL);
X    switch (photometric)
X    {
X      case PHOTOMETRIC_RGB:
X      {
X        switch (bits_per_sample)
X        {
X          case 8:
X          default:
X          {
X            /*
X              Assumes Max Sample Value is 255.
X            */
X            for (x=0; x < image->columns; x++)
X            {
X              if (planar_configuration == PLANARCONFIG_CONTIG)
X                {
X                  red=(*p++);
X                  green=(*p++);
X                  blue=(*p++);
X                }
X              else
X                {
X                  red=(*p);
X                  green=(*(p+TIFFScanlineSize(file)));
X                  blue=(*(p+2*TIFFScanlineSize(file)));
X                  p++;
X                }
X              if ((red == q->red) && (green == q->green) && 
X                  (blue == q->blue) && (q->length < MaxRunlength))
X                q->length++;
X              else
X                {
X                  if (image->packets > 0)
X                    q++;
X                  image->packets++;
X                  q->red=red;
X                  q->green=green;
X                  q->blue=blue;
X                  q->index=0;
X                  q->length=0;
X                }
X              if (samples_per_pixel == 4)
X                p++;
X            }
X            break;
X          }
X          case 16:
X          {
X            register unsigned short
X              *p;
X
X            /*
X              Assumes Max Sample Value is 2047.
X            */
X            p=(unsigned short *) scanline;
X            for (x=0; x < image->columns; x++)
X            {
X              if (planar_configuration == PLANARCONFIG_CONTIG)
X                {
X                  red=(*p++ >> 3);
X                  green=(*p++ >> 3);
X                  blue=(*p++ >> 3);
X                }
X              else
X                {
X                  red=(*p >> 3);
X                  green=(*(p+TIFFScanlineSize(file)) >> 3);
X                  blue=(*(p+2*TIFFScanlineSize(file)) >> 3);
X                  p++;
X                }
X              if ((red == q->red) && (green == q->green) && 
X                  (blue == q->blue) && (q->length < MaxRunlength))
X                q->length++;
X              else
X                {
X                  if (image->packets > 0)
X                    q++;
X                  image->packets++;
X                  q->red=red;
X                  q->green=green;
X                  q->blue=blue;
X                  q->index=0;
X                  q->length=0;
X                }
X              if (samples_per_pixel == 4)
X                p++;
X            }
X            break;
X          }
X        }
X        break;
X      }
X      case PHOTOMETRIC_MINISBLACK:
X      case PHOTOMETRIC_MINISWHITE:
X      {
X        switch (bits_per_sample)
X        {
X          case 1:
X          {
X            register int
X              bit;
X
X            for (x=0; x < image->columns; x+=8)
X            {
X              for (bit=7; bit >= 0; bit--)
X              {
X                index=((*p) & (0x01 << bit) ? 0x01 : 0x00);
X                red=image->colormap[index].red;
X                green=image->colormap[index].green;
X                blue=image->colormap[index].blue;
X                if ((red == q->red) && (green == q->green) &&
X                    (blue == q->blue) && (q->length < MaxRunlength))
X                  q->length++;
X                else
X                  {
X                    if (image->packets > 0)
X                      q++;
X                    image->packets++;
X                    q->red=red;
X                    q->green=green;
X                    q->blue=blue;
X                    q->index=index;
X                    q->length=0;
X                  }
X              }
X              p++;
X            }
X            if ((image->columns % 8) != 0)
X              {
X                for (bit=7; bit >= (8-(image->columns % 8)); bit--)
X                {
X                  index=((*p) & (0x01 << bit) ? 0x00 : 0x01);
X                  red=image->colormap[index].red;
X                  green=image->colormap[index].green;
X                  blue=image->colormap[index].blue;
X                  if ((red == q->red) && (green == q->green) &&
X                      (blue == q->blue) && (q->length < MaxRunlength))
X                    q->length++;
X                  else
X                    {
X                      if (image->packets > 0)
X                        q++;
X                      image->packets++;
X                      q->red=red;
X                      q->green=green;
X                      q->blue=blue;
X                      q->index=index;
X                      q->length=0;
X                    }
X                }
X                p++;
X              }
X            break;
X          }
X          case 2:
X          {
X            for (x=0; x < image->columns; x+=4)
X            {
X              index=(*p >> 6) & 3;
X              red=image->colormap[index].red;
X              green=image->colormap[index].green;
X              blue=image->colormap[index].blue;
X              if ((red == q->red) && (green == q->green) &&
X                  (blue == q->blue) && (q->length < MaxRunlength))
X                q->length++;
X              else
X                {
X                  if (image->packets > 0)
X                    q++;
X                  image->packets++;
X                  q->red=red;
X                  q->green=green;
X                  q->blue=blue;
X                  q->index=index;
X                  q->length=0;
X                }
X              index=(*p >> 4) & 3;
X              red=image->colormap[index].red;
X              green=image->colormap[index].green;
X              blue=image->colormap[index].blue;
X              if ((red == q->red) && (green == q->green) &&
X                  (blue == q->blue) && (q->length < MaxRunlength))
X                q->length++;
X              else
X                {
X                  if (image->packets > 0)
X                    q++;
X                  image->packets++;
X                  q->red=red;
X                  q->green=green;
X                  q->blue=blue;
X                  q->index=index;
X                  q->length=0;
X                }
X              index=(*p >> 2) & 3;
X              red=image->colormap[index].red;
X              green=image->colormap[index].green;
X              blue=image->colormap[index].blue;
X              if ((red == q->red) && (green == q->green) &&
X                  (blue == q->blue) && (q->length < MaxRunlength))
X                q->length++;
X              else
X                {
X                  if (image->packets > 0)
X                    q++;
X                  image->packets++;
X                  q->red=red;
X                  q->green=green;
X                  q->blue=blue;
X                  q->index=index;
X                  q->length=0;
X                }
X              index=(*p) & 3;
X              red=image->colormap[index].red;
X              green=image->colormap[index].green;
X              blue=image->colormap[index].blue;
X              if ((red == q->red) && (green == q->green) &&
X                  (blue == q->blue) && (q->length < MaxRunlength))
X                q->length++;
X              else
X                {
X                  if (image->packets > 0)
X                    q++;
X                  image->packets++;
X                  q->red=red;
X                  q->green=green;
X                  q->blue=blue;
X                  q->index=index;
X                  q->length=0;
X                }
X              p++;
X            }
X            break;
X          }
X          case 4:
X          {
X            for (x=0; x < image->columns; x+=2)
X            {
X              index=(*p >> 4);
X              red=image->colormap[index].red;
X              green=image->colormap[index].green;
X              blue=image->colormap[index].blue;
X              if ((red == q->red) && (green == q->green) &&
X                  (blue == q->blue) && (q->length < MaxRunlength))
X                q->length++;
X              else
X                {
X                  if (image->packets > 0)
X                    q++;
X                  image->packets++;
X                  q->red=red;
X                  q->green=green;
X                  q->blue=blue;
X                  q->index=index;
X                  q->length=0;
X                }
X              index=(*p) & 0xf;
X              red=image->colormap[index].red;
X              green=image->colormap[index].green;
X              blue=image->colormap[index].blue;
X              if ((red == q->red) && (green == q->green) &&
X                  (blue == q->blue) && (q->length < MaxRunlength))
X                q->length++;
X              else
X                {
X                  if (image->packets > 0)
X                    q++;
X                  image->packets++;
X                  q->red=red;
X                  q->green=green;
X                  q->blue=blue;
X                  q->index=index;
X                  q->length=0;
X                }
X              p++;
X            }
X            break;
X          }
X          case 8:
X          {
X            for (x=0; x < image->columns; x++)
X            {
X              index=(*p);
X              red=image->colormap[index].red;
X              green=image->colormap[index].green;
X              blue=image->colormap[index].blue;
X              if ((red == q->red) && (green == q->green) &&
X                  (blue == q->blue) && (q->length < MaxRunlength))
X                q->length++;
X              else
X                {
X                  if (image->packets > 0)
X                    q++;
X                  image->packets++;
X                  q->red=red;
X                  q->green=green;
X                  q->blue=blue;
X                  q->index=index;
X                  q->length=0;
X                }
X              p++;
X            }
X            break;
X          }
X          default:
X            break;
X        }
X        break;
X      }
X      case PHOTOMETRIC_PALETTE:
X      {
X        for (x=0; x < image->columns; x++)
X        {
X          index=(*p++);
X          red=image->colormap[index].red;
X          green=image->colormap[index].green;
X          blue=image->colormap[index].blue;
X          if ((red == q->red) && (green == q->green) && (blue == q->blue) && 
X              (q->length < MaxRunlength))
X            q->length++;
X          else
X            {
X              if (image->packets > 0)
X                q++;
X              image->packets++;
X              q->red=red;
X              q->green=green;
X              q->blue=blue;
X              q->index=index;
X              q->length=0;
X            }
X        }
X        break;
X      }
X      default:
X        break;
X    }
X  }
X  free((char *) scanline);
X  TIFFClose(file);
X  if (image->class == PseudoClass)
X    QuantizeImage(image,image->colors,8,False,True);
X  if (image->packets > ((image->columns*image->rows*3) >> 2))
X    image->compression=NoCompression;
X  image->pixels=(RunlengthPacket *)
X    realloc((char *) image->pixels,image->packets*sizeof(RunlengthPacket));
X  return(image);
}
X
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   U s a g e                                                                 %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Procedure Usage displays the program usage;
%
%  The format of the Usage routine is:
%
%      Usage(message)
%
%  A description of each parameter follows:
%
%    program_name:  Specifies the name of this program.
%
%    message:  Specifies a specific message to display to the user.
%
*/
static void Usage(message)
char
X  *message;
{
X  if (message != (char *) NULL)
X    (void) fprintf(stderr,"Can't continue, %s\n\n",message);
X  (void) fprintf(stderr,"Usage: %s [-scene #] image.tiff image.miff\n\n",
X    application_name);
X  (void) fprintf(stderr,"Specify 'image.tiff' as '-' for standard input.\n");
X  (void) fprintf(stderr,"Specify 'image.miff' as '-' for standard output.\n");
X  exit(1);
}
X
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%  M a i n                                                                    %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
*/
int main(argc,argv)
int
X  argc;
X   
char
X  *argv[];
{
X  char
X    filename[256];
X
X  Image
X    *image;
X
X  int
X    i;
X
X  unsigned int
X    scene;
X
X  /*
X    Initialize program variables.
X  */
X  application_name=argv[0];
X  i=1;
X  scene=0;
X  if (argc < 3)
X    Usage((char *) NULL);
X  /*
X    Read image and convert to MIFF format.
X  */
X  if (strncmp(argv[i],"-scene",2) == 0)
X    {
X      i++;
X      scene=atoi(argv[i++]);
X    }
X  (void) strcpy(filename,argv[i++]);
X  image=ReadTIFFImage(filename);
X  if (image == (Image *) NULL)
X    exit(1);
X  (void) strcpy(image->filename,argv[i++]);
X  image->scene=scene;
X  (void) WriteImage(image);
X  (void) fprintf(stderr,"%s => %s  %dx%d\n",filename,image->filename,
X    image->columns,image->rows);
X  DestroyImage(image);
X  return(False);
}
SHAR_EOF
chmod 0755 ImageMagick/filters/TIFFtoMIFF.c ||
echo 'restore of ImageMagick/filters/TIFFtoMIFF.c failed'
Wc_c="`wc -c < 'ImageMagick/filters/TIFFtoMIFF.c'`"
test 25596 -eq "$Wc_c" ||
	echo 'ImageMagick/filters/TIFFtoMIFF.c: original size 25596, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= ImageMagick/filters/MIFFtoTIFF.c ==============
if test -f 'ImageMagick/filters/MIFFtoTIFF.c' -a X"$1" != X"-c"; then
	echo 'x - skipping ImageMagick/filters/MIFFtoTIFF.c (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting ImageMagick/filters/MIFFtoTIFF.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/filters/MIFFtoTIFF.c' &&
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%                 EEEEE  X   X  PPPP    OOO   RRRR    TTTTT                   %
%                 E       X X   P   P  O   O  R   R     T                     %
%                 EEE      X    PPPP   O   O  RRRR      T                     %
%                 E       X X   P      O   O  R R       T                     %
%                 EEEEE  X   X  P       OOO   R  R      T                     %
%                                                                             %
%                                                                             %
%                 Export MIFF image to a TIFF raster format.                  %
%                                                                             %
%                                                                             %
%                                                                             %
%                           Software Design                                   %
%                             John Cristy                                     %
%                            January  1991                                    %
SHAR_EOF
true || echo 'restore of ImageMagick/filters/MIFFtoTIFF.c failed'
fi
echo 'End of ImageMagick part 12'
echo 'File ImageMagick/filters/MIFFtoTIFF.c is continued in part 13'
echo 13 > _shar_seq_.tmp
exit 0
--
Dan Heller
O'Reilly && Associates       Z-Code Software    Comp-sources-x:
Senior Writer                President          comp-sources-x at uunet.uu.net
argv at ora.com                 argv at zipcode.com



More information about the Comp.sources.x mailing list