home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: alt.sources.patches
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!darwin.sura.net!udel!louie!eplrx7!eplrx7.es.dupont.com!cristy
- From: cristy@eplrx7.es.duPont.com (Cristy)
- Subject: ImageMagick 2.1 - patch 04
- Message-ID: <cristy.722025924@eplrx7.es.dupont.com>
- Summary: X11 image processing and display utilities
- Keywords: X11 image display image-processing JPEG TIFF GIF
- Organization: DuPont Engineering Physics Laboratory
- Date: Tue, 17 Nov 1992 18:45:24 GMT
- Lines: 329
-
- To apply this patch:
-
- cd to the top of the source tree (to the directory containing the
- "ImageMagick" directory) and do:
-
- patch -p -s < ThisFile
-
- Patch will work silently unless an error occurs. If you want to watch
- patch do its thing, leave out the "-s" argument to patch.
-
- Finally, to rebuild after applying this patch, cd to the "ImageMagick"
- directory and type:
-
- make
-
- The entire distribution is available as contrib/ImageMagick.tar.Z on
- export.lcs.mit.edu.
-
- Brief notes on what this patch fixes:
-
- o Using `-colorspace gray' with 'convert' correctly produces grayscale
- images.
- o Images are sorted by intensity for shared colormapped visuals. Some
- intensity intervals are made "more popular". This gives better
- image results when sharing colors with other applications.
-
- diff -c -r ImageMagick/README ImageMagick2.1.4/README
- *** ImageMagick/README Sun Nov 15 20:40:54 1992
- --- ImageMagick2.1.4/README Fri Nov 13 11:09:37 1992
- ***************
- *** 69,75 ****
- mtv:image.mtv).
-
- ImageMagick requires GNU's Ghostscript software available via FTP as
- ! ftp.uu.net:packages/gnu/ghostscript-2.5.2.tar.Z to read the
- Postscript format. For ImageMagick to read Postscript files, `gs'
- must be in your execution path and the `ppmraw' device must be
- recognized. Add it to your 'DEVICE_DEVS' define in your `Makefile'
- --- 69,75 ----
- mtv:image.mtv).
-
- ImageMagick requires GNU's Ghostscript software available via FTP as
- ! ftp.uu.net:systems/gnu/ghostscript-2.5.2.tar.Z to read the
- Postscript format. For ImageMagick to read Postscript files, `gs'
- must be in your execution path and the `ppmraw' device must be
- recognized. Add it to your 'DEVICE_DEVS' define in your `Makefile'
- diff -c -r ImageMagick/X.c ImageMagick2.1.4/X.c
- *** ImageMagick/X.c Sun Nov 15 20:40:57 1992
- --- ImageMagick2.1.4/X.c Tue Nov 17 10:20:04 1992
- ***************
- *** 3833,3849 ****
- %
- %
- */
- static int PopularityCompare(x,y)
- const void
- *x,
- *y;
- {
- ! PopularityPacket
- *color_1,
- *color_2;
-
- ! color_1=(PopularityPacket *) x;
- ! color_2=(PopularityPacket *) y;
- return((int) color_2->count-(int) color_1->count);
- }
-
- --- 3833,3863 ----
- %
- %
- */
- + static int IntensityCompare(x,y)
- + const void
- + *x,
- + *y;
- + {
- + DiversityPacket
- + *color_1,
- + *color_2;
- +
- + color_1=(DiversityPacket *) x;
- + color_2=(DiversityPacket *) y;
- + return((int) Intensity(*color_2)-(int) Intensity(*color_1));
- + }
- +
- static int PopularityCompare(x,y)
- const void
- *x,
- *y;
- {
- ! DiversityPacket
- *color_1,
- *color_2;
-
- ! color_1=(DiversityPacket *) x;
- ! color_2=(DiversityPacket *) y;
- return((int) color_2->count-(int) color_1->count);
- }
-
- ***************
- *** 4023,4030 ****
- colormap_type=PrivateColormap;
- if (colormap_type == SharedColormap)
- {
- ! PopularityPacket
- ! *popularity;
-
- register RunlengthPacket
- *q;
- --- 4037,4044 ----
- colormap_type=PrivateColormap;
- if (colormap_type == SharedColormap)
- {
- ! DiversityPacket
- ! *diversity;
-
- register RunlengthPacket
- *q;
- ***************
- *** 4033,4066 ****
- index;
-
- /*
- ! Define Standard colormap for shared GrayScale or PseudoColor visual.
- */
- ! popularity=(PopularityPacket *)
- ! malloc(image->colors*sizeof(PopularityPacket));
- ! if (popularity == (PopularityPacket *) NULL)
- Error("unable to create colormap","memory allocation failed");
- for (i=0; i < image->colors; i++)
- {
- ! popularity[i].count=0;
- ! popularity[i].index=(unsigned short) i;
- }
- q=image->pixels;
- for (i=0; i < image->packets; i++)
- {
- ! popularity[q->index].count+=(q->length+1);
- q++;
- }
- - (void) qsort((void *) popularity,(int) image->colors,
- - sizeof(PopularityPacket),PopularityCompare);
- /*
- ! Allocate colors in order of decreasing popularity.
- */
- p=colors;
- color.flags=DoRed | DoGreen | DoBlue;
- if (visual_info->class == PseudoColor)
- for (i=0; i < image->colors; i++)
- {
- ! index=popularity[i].index;
- color.red=(unsigned short) (image->colormap[index].red << 8);
- color.green=(unsigned short) (image->colormap[index].green << 8);
- color.blue=(unsigned short) (image->colormap[index].blue << 8);
- --- 4047,4091 ----
- index;
-
- /*
- ! Define Standard colormap for shared GrayScale or PseudoColor visual:
- */
- ! diversity=(DiversityPacket *)
- ! malloc(image->colors*sizeof(DiversityPacket));
- ! if (diversity == (DiversityPacket *) NULL)
- Error("unable to create colormap","memory allocation failed");
- for (i=0; i < image->colors; i++)
- {
- ! diversity[i].red=image->colormap[i].red;
- ! diversity[i].green=image->colormap[i].green;
- ! diversity[i].blue=image->colormap[i].blue;
- ! diversity[i].index=(unsigned short) i;
- ! diversity[i].count=0;
- }
- q=image->pixels;
- for (i=0; i < image->packets; i++)
- {
- ! diversity[q->index].count+=(q->length+1);
- q++;
- }
- /*
- ! Sort colors by decreasing intensity.
- */
- + (void) qsort((void *) diversity,(int) image->colors,
- + sizeof(DiversityPacket),IntensityCompare);
- + for (i=0; i < image->colors; i+=Max(image->colors >> 4,2))
- + diversity[i].count<<=4; /* increase this colors popularity */
- + diversity[image->colors-1].count<<=4;
- + (void) qsort((void *) diversity,(int) image->colors,
- + sizeof(DiversityPacket),PopularityCompare);
- + /*
- + Allocate colors.
- + */
- p=colors;
- color.flags=DoRed | DoGreen | DoBlue;
- if (visual_info->class == PseudoColor)
- for (i=0; i < image->colors; i++)
- {
- ! index=diversity[i].index;
- color.red=(unsigned short) (image->colormap[index].red << 8);
- color.green=(unsigned short) (image->colormap[index].green << 8);
- color.blue=(unsigned short) (image->colormap[index].blue << 8);
- ***************
- *** 4073,4079 ****
- else
- for (i=0; i < image->colors; i++)
- {
- ! index=popularity[i].index;
- gray_value=Intensity(image->colormap[index]);
- color.red=(unsigned short) (gray_value << 8);
- color.green=(unsigned short) (gray_value << 8);
- --- 4098,4104 ----
- else
- for (i=0; i < image->colors; i++)
- {
- ! index=diversity[i].index;
- gray_value=Intensity(image->colormap[index]);
- color.red=(unsigned short) (gray_value << 8);
- color.green=(unsigned short) (gray_value << 8);
- ***************
- *** 4109,4115 ****
- if (visual_info->class == PseudoColor)
- for (; i < image->colors; i++)
- {
- ! index=popularity[i].index;
- color.red=(unsigned short) (image->colormap[index].red << 8);
- color.green=(unsigned short)
- (image->colormap[index].green << 8);
- --- 4134,4140 ----
- if (visual_info->class == PseudoColor)
- for (; i < image->colors; i++)
- {
- ! index=diversity[i].index;
- color.red=(unsigned short) (image->colormap[index].red << 8);
- color.green=(unsigned short)
- (image->colormap[index].green << 8);
- ***************
- *** 4124,4130 ****
- else
- for (; i < image->colors; i++)
- {
- ! index=popularity[i].index;
- gray_value=Intensity(image->colormap[index]);
- color.red=(unsigned short) (gray_value << 8);
- color.green=(unsigned short) (gray_value << 8);
- --- 4149,4155 ----
- else
- for (; i < image->colors; i++)
- {
- ! index=diversity[i].index;
- gray_value=Intensity(image->colormap[index]);
- color.red=(unsigned short) (gray_value << 8);
- color.green=(unsigned short) (gray_value << 8);
- ***************
- *** 4148,4154 ****
- }
- (void) free((void *) server_colors);
- }
- ! (void) free((void *) popularity);
- break;
- }
- /*
- --- 4173,4179 ----
- }
- (void) free((void *) server_colors);
- }
- ! (void) free((void *) diversity);
- break;
- }
- /*
- diff -c -r ImageMagick/X.h ImageMagick2.1.4/X.h
- *** ImageMagick/X.h Sun Nov 15 20:40:57 1992
- --- ImageMagick2.1.4/X.h Mon Nov 16 17:09:39 1992
- ***************
- *** 33,46 ****
- /*
- Typedef declarations.
- */
- ! typedef struct _PopularityPacket
- {
- ! unsigned long
- ! count;
-
- unsigned short
- index;
- ! } PopularityPacket;
-
- typedef struct _XAnnotateInfo
- {
- --- 33,51 ----
- /*
- Typedef declarations.
- */
- ! typedef struct _DiversityPacket
- {
- ! unsigned char
- ! red,
- ! green,
- ! blue;
-
- unsigned short
- index;
- !
- ! unsigned long
- ! count;
- ! } DiversityPacket;
-
- typedef struct _XAnnotateInfo
- {
- Only in ImageMagick: display.c.orig
- Common subdirectories: ImageMagick/images and ImageMagick2.1.4/images
- Common subdirectories: ImageMagick/scenes and ImageMagick2.1.4/scenes
- Common subdirectories: ImageMagick/utilities and ImageMagick2.1.4/utilities
- Common subdirectories: ImageMagick/xtp and ImageMagick2.1.4/xtp
- diff -c -r ImageMagick/utilities/convert.c ImageMagick2.1.4/utilities/convert.c
- *** ImageMagick/utilities/convert.c Sun Nov 15 20:41:23 1992
- --- ImageMagick2.1.4/utilities/convert.c Mon Nov 16 17:57:34 1992
- ***************
- *** 477,482 ****
- --- 477,484 ----
- image->colors=NumberColors(image);
- total_colors=image->colors;
- }
- + if (colorspace == GRAYColorspace)
- + QuantizeImage(image,256,8,dither,GRAYColorspace,True);
- if (number_colors > 0)
- if ((image->class == DirectClass) || (image->colors > number_colors))
- QuantizeImage(image,number_colors,tree_depth,dither,colorspace,True);
- --
- cristy@dupont.com
-