home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume20 / imagemgc / part03 < prev    next >
Encoding:
Text File  |  1993-07-13  |  50.4 KB  |  1,325 lines

  1. Newsgroups: comp.sources.x
  2. From: cristy@eplrx7.es.duPont.com (Cristy)
  3. Subject: v20i059:  imagemagic - X11 image processing and display, Part03/38
  4. Message-ID: <1993Jul14.175250.701@sparky.sterling.com>
  5. X-Md4-Signature: 3bbefe01cad948b8d584f7ca521c4231
  6. Sender: chris@sparky.sterling.com (Chris Olson)
  7. Organization: Sterling Software
  8. Date: Wed, 14 Jul 1993 17:52:50 GMT
  9. Approved: chris@sterling.com
  10.  
  11. Submitted-by: cristy@eplrx7.es.duPont.com (Cristy)
  12. Posting-number: Volume 20, Issue 59
  13. Archive-name: imagemagic/part03
  14. Environment: X11
  15. Supersedes: imagemagic: Volume 13, Issue 17-37
  16.  
  17. #!/bin/sh
  18. # this is magick.03 (part 3 of ImageMagick)
  19. # do not concatenate these parts, unpack them in order with /bin/sh
  20. # file ImageMagick/utilities/mogrify.man continued
  21. #
  22. if test ! -r _shar_seq_.tmp; then
  23.     echo 'Please unpack part 1 first!'
  24.     exit 1
  25. fi
  26. (read Scheck
  27.  if test "$Scheck" != 3; then
  28.     echo Please unpack part "$Scheck" next!
  29.     exit 1
  30.  else
  31.     exit 0
  32.  fi
  33. ) < _shar_seq_.tmp || exit 1
  34. if test ! -f _shar_wnt_.tmp; then
  35.     echo 'x - still skipping ImageMagick/utilities/mogrify.man'
  36. else
  37. echo 'x - continuing file ImageMagick/utilities/mogrify.man'
  38. sed 's/^X//' << 'SHAR_EOF' >> 'ImageMagick/utilities/mogrify.man' &&
  39. .TP 5
  40. .B "-rotate \fIdegrees\fP"
  41. apply Paeth image rotation to the image.
  42. X
  43. Empty triangles left over from rotating the image are filled with the
  44. color defined by the pixel at location (0,0).  Refer to \fB-border\fP
  45. to choose a specific color.
  46. .TP 5
  47. .B "-scale \fI<width factor>x<height factor>\fP"
  48. preferred size factors of the image.
  49. X
  50. This option behaves like \fB-geometry\fP except the width and height values
  51. are relative instead of absolute.  The image size is multiplied by the
  52. width and height factors to obtain the final image dimensions.  If only
  53. one factor is specified, both the width and height factors assume the
  54. value.
  55. X
  56. Factors may be fractional.  To increase the size of an image, use a
  57. scale factor greater than 1.0.  To decrease an image's size, use a
  58. scale factor less than 1.0.  Default is 1.0.
  59. .TP 5
  60. .B "-scene \fIvalue\fP"
  61. image scene number.
  62. .TP 5
  63. .B "-shear \fI<x degrees>x<y degrees>\fP"
  64. shear the image along the X or Y axis by a positive or negative shear angle.
  65. X
  66. Shearing slides one edge of an image along the X or Y axis, creating a
  67. parallelogram.  An X direction shear slides an edge along the X axis,
  68. while a Y direction shear slides an edge along the Y axis.  The amount
  69. of the shear is controlled by a shear angle.  For X direction shears,
  70. \fIx degrees>\fP is measured relative to the Y axis, and similarly, for
  71. Y direction shears \fIy degrees\fP is measured relative to the X axis.
  72. X
  73. Empty triangles left over from shearing the image are filled with the
  74. color defined by the pixel at location (0,0).  Refer to \fB-border\fP
  75. to choose a specific color.
  76. .TP 5
  77. .B "-treedepth \fIvalue\fP"
  78. Normally, this integer value is zero or one.  A zero or one tells
  79. \fBmogrify\fP to choose a optimal tree depth for the color reduction
  80. algorithm.
  81. X
  82. An optimal depth generally allows the best representation of the source
  83. image with the fastest computational speed and the least amount of
  84. memory.  However, the default depth is inappropriate for some images.
  85. To assure the best representation, try values between 2 and 8 for this
  86. parameter.  Refer to \fBquantize(9)\fP for more details.
  87. X
  88. The \fB-colors\fP or \fB-monochrome\fP option is required for this option
  89. to take effect.
  90. .TP 5
  91. .B "-undercolor \fI<undercolor factor>x<black-generation factor>\fP"
  92. control undercolor removal and black generation on CMYK images.
  93. X
  94. This option enables you to perform undercolor removal and black
  95. generation on CMYK images-- images to be printed on a four-color
  96. printing system. You can control how much cyan, magenta, and yellow
  97. to remove from your image and how much black to add to it.
  98. The standard undercolor removal is \fB1.0x1.0\fP.  You'll
  99. frequently get better results, though, if the percentage of black you
  100. add to your image is slightly higher than the percentage of C, M, and Y
  101. you remove from it.  For example you might try \fB0.5x0.7\fP.
  102. .TP 5
  103. .B -verbose
  104. print detailed information about the image.
  105. X
  106. This information is printed: image scene number;  image name;  image
  107. size; the image class (\fIDirectClass\fP or \fIPseudoClass\fP); the total
  108. number of unique colors (if known);  and the number of seconds to read and
  109. transform the image.  Refer to \fBmiff(5)\fP for a description of
  110. the image class.
  111. X
  112. If \fB-colors\fP is also specified, the total unique colors in the image
  113. and color reduction error values are printed.  Refer to \fBquantize(9)\fP
  114. for a description of these values.
  115. .PP
  116. Any option you specify on the command line remains in effect until it is
  117. explicitly changed by specifying the option again with a different effect.
  118. For example, to mogrify two images, the first with 32 colors and the
  119. second with only 16 colors, use:
  120. .PP
  121. X     mogrify -colors 32 cockatoo.miff -colors 16 macaw.miff
  122. .PP
  123. Change \fI-\fP to \fI\+\fP in any option above to reverse its effect.
  124. For example, specify \fB\+compress\fP to store the binary image in an
  125. uncompressed format.
  126. .PP
  127. By default, the image format is determined by its magic number. To
  128. specify a particular image format, precede the filename with an image
  129. format name and a colon (i.e. ps:image) or specify the image type as
  130. the filename suffix (i.e. image.ps).  See \fBconvert(1)\fP for a list
  131. of valid image formats.
  132. .PP
  133. Specify \fIfile\fP as \fI-\fP for standard input and output.  If
  134. \fIfile\fP has the extension \fB.Z\fP or \fB.gz\fP, the file is
  135. uncompressed with \fBuncompress\fP or \fBgunzip\fP respectively and
  136. subsequently compressed using with \fBcompress\fP or \fBgzip\fP.
  137. .SH SEE ALSO
  138. .B
  139. display(1), animate(1), import(1), convert(1), quantize(9), miff(5), X(1), compress(1)
  140. .SH COPYRIGHT
  141. Copyright 1993 E. I. du Pont de Nemours & Company
  142. .PP
  143. Permission to use, copy, modify, distribute, and sell this software and
  144. its documentation for any purpose is hereby granted without fee,
  145. provided that the above copyright notice appear in all copies and that
  146. both that copyright notice and this permission notice appear in
  147. supporting documentation, and that the name of E. I. du Pont de Nemours
  148. & Company not be used in advertising or publicity pertaining to
  149. distribution of the software without specific, written prior
  150. permission.  E. I. du Pont de Nemours & Company makes no representations
  151. about the suitability of this software for any purpose.  It is provided
  152. "as is" without express or implied warranty.
  153. .PP
  154. E. I. du Pont de Nemours & Company disclaims all warranties with regard
  155. to this software, including all implied warranties of merchantability
  156. and fitness, in no event shall E. I. du Pont de Nemours & Company be
  157. liable for any special, indirect or consequential damages or any
  158. damages whatsoever resulting from loss of use, data or profits, whether
  159. in an action of contract, negligence or other tortious action, arising
  160. out of or in connection with the use or performance of this software.
  161. .SH ACKNOWLEDGEMENTS
  162. Michael Halle, Spatial Imaging Group at MIT, for the initial
  163. implementation of Alan Paeth's image rotation algorithm.
  164. .PP
  165. David Pensak, E. I. du Pont de Nemours & Company, for providing a
  166. computing environment that made this program possible.
  167. .PP
  168. Paul Raveling, USC Information Sciences Institute, for the original
  169. idea of using space subdivision for the color reduction algorithm.
  170. .SH AUTHORS
  171. John Cristy, E.I. du Pont de Nemours & Company Incorporated
  172. SHAR_EOF
  173. echo 'File ImageMagick/utilities/mogrify.man is complete' &&
  174. chmod 0644 ImageMagick/utilities/mogrify.man ||
  175. echo 'restore of ImageMagick/utilities/mogrify.man failed'
  176. Wc_c="`wc -c < 'ImageMagick/utilities/mogrify.man'`"
  177. test 13912 -eq "$Wc_c" ||
  178.     echo 'ImageMagick/utilities/mogrify.man: original size 13912, current size' "$Wc_c"
  179. rm -f _shar_wnt_.tmp
  180. fi
  181. # ============= ImageMagick/utilities/combine.c ==============
  182. if test -f 'ImageMagick/utilities/combine.c' -a X"$1" != X"-c"; then
  183.     echo 'x - skipping ImageMagick/utilities/combine.c (File already exists)'
  184.     rm -f _shar_wnt_.tmp
  185. else
  186. > _shar_wnt_.tmp
  187. echo 'x - extracting ImageMagick/utilities/combine.c (Text)'
  188. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/utilities/combine.c' &&
  189. /*
  190. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  191. %                                                                             %
  192. %                                                                             %
  193. %                                                                             %
  194. %                CCCC   OOO   M   M  BBBB   IIIII  N   N  EEEEE               %
  195. %               C      O   O  MM MM  B   B    I    NN  N  E                   %
  196. %               C      O   O  M M M  BBBB     I    N N N  EEE                 %
  197. %               C      O   O  M   M  B   B    I    N  NN  E                   %
  198. %                CCCC   OOO   M   N  BBBB   IIIII  N   N  EEEEE               %
  199. %                                                                             %
  200. %                                                                             %
  201. %                        Digitally combine two images.                        %
  202. %                                                                             %
  203. %                                                                             %
  204. %                                                                             %
  205. %                              Software Design                                %
  206. %                                John Cristy                                  %
  207. %                               January 1993                                  %
  208. %                                                                             %
  209. %                                                                             %
  210. %  Copyright 1993 E. I. Dupont de Nemours & Company                           %
  211. %                                                                             %
  212. %  Permission to use, copy, modify, distribute, and sell this software and    %
  213. %  its documentation for any purpose is hereby granted without fee,           %
  214. %  provided that the above Copyright notice appear in all copies and that     %
  215. %  both that Copyright notice and this permission notice appear in            %
  216. %  supporting documentation, and that the name of E. I. Dupont de Nemours     %
  217. %  & Company not be used in advertising or publicity pertaining to            %
  218. %  distribution of the software without specific, written prior               %
  219. %  permission.  E. I. Dupont de Nemours & Company makes no representations    %
  220. %  about the suitability of this software for any purpose.  It is provided    %
  221. %  "as is" without express or implied warranty.                               %
  222. %                                                                             %
  223. %  E. I. Dupont de Nemours & Company disclaims all warranties with regard     %
  224. %  to this software, including all implied warranties of merchantability      %
  225. %  and fitness, in no event shall E. I. Dupont de Nemours & Company be        %
  226. %  liable for any special, indirect or consequential damages or any           %
  227. %  damages whatsoever resulting from loss of use, data or profits, whether    %
  228. %  in an action of contract, negligence or other tortious action, arising     %
  229. %  out of or in connection with the use or performance of this software.      %
  230. %                                                                             %
  231. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  232. %
  233. %  The combine program syntax is:
  234. %
  235. %  Usage: combine [options ...] input_file1 input_file2 output_file
  236. %
  237. %  Where options include:
  238. %    -alpha              store alpha channel if the image has one
  239. %    -colors value       preferred number of colors in the image
  240. %    -compose operator   composite operator
  241. %    -colorspace type    GRAY, RGB, XYZ, YCbCr, YIQ, or YUV
  242. %    -compress type      RunlengthEncoded or QEncoded
  243. %    -density geometry   vertical and horizonal density of the image
  244. %    -display server     obtain image or font from this X server
  245. %    -dither             apply Floyd/Steinberg error diffusion to image
  246. %    -font name          X11 font for displaying text
  247. %    -geometry geometry  width and height of the image
  248. %    -interlace type     NONE, LINE, or PLANE
  249. %    -page geometry      size and location of the Postscript page
  250. %    -quality value      JPEG quality setting
  251. %    -scene value        image scene number
  252. %    -stereo             combine two images to form red-green stereo image
  253. %    -treedepth value    depth of the color classification tree
  254. %    -verbose            print detailed information about the image
  255. %
  256. %  Change '-' to '+' in any option above to reverse its effect.  For
  257. %  example,  specify +alpha to store the image without its alpha channel.
  258. %
  259. %
  260. */
  261. X
  262. #include "display.h"
  263. #include "image.h"
  264. #include "X.h"
  265. X
  266. /*
  267. X  Global declarations.
  268. */
  269. char
  270. X  *client_name;
  271. X
  272. /*
  273. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  274. %                                                                             %
  275. %                                                                             %
  276. %                                                                             %
  277. %   E r r o r                                                                 %
  278. %                                                                             %
  279. %                                                                             %
  280. %                                                                             %
  281. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  282. %
  283. %  Function Error displays an error message and then terminates the program.
  284. %
  285. %  The format of the Error routine is:
  286. %
  287. %      Error(message,qualifier)
  288. %
  289. %  A description of each parameter follows:
  290. %
  291. %    o message: Specifies the message to display before terminating the
  292. %      program.
  293. %
  294. %    o qualifier: Specifies any qualifier to the message.
  295. %
  296. %
  297. */
  298. void Error(message,qualifier)
  299. char
  300. X  *message,
  301. X  *qualifier;
  302. {
  303. X  (void) fprintf(stderr,"%s: %s",client_name,message);
  304. X  if (qualifier != (char *) NULL)
  305. X    (void) fprintf(stderr," (%s)",qualifier);
  306. X  (void) fprintf(stderr,".\n");
  307. X  exit(1);
  308. }
  309. X
  310. /*
  311. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  312. %                                                                             %
  313. %                                                                             %
  314. %                                                                             %
  315. %   U s a g e                                                                 %
  316. %                                                                             %
  317. %                                                                             %
  318. %                                                                             %
  319. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  320. %
  321. %  Procedure Usage displays the program usage;
  322. %
  323. %  The format of the Usage routine is:
  324. %
  325. %      Usage()
  326. %
  327. %
  328. */
  329. static void Usage()
  330. {
  331. X  char
  332. X    **p;
  333. X
  334. X  static char
  335. X    *options[]=
  336. X    {
  337. X      "-alpha              store alpha channel if the image has one",
  338. X      "-colors value       preferred number of colors in the image",
  339. X      "-colorspace type    GRAY, RGB, XYZ, YCbCr, YIQ, or YUV",
  340. X      "-compose operator   composite operator",
  341. X      "-compress type      RunlengthEncoded or QEncoded",
  342. X      "-density geometry   vertical and horizonal density of the image",
  343. X      "-display server     obtain image or font from this X server",
  344. X      "-dither             apply Floyd/Steinberg error diffusion to image",
  345. X      "-font name          X11 font for displaying text",
  346. X      "-geometry geometry  width and height of the image",
  347. X      "-interlace type     NONE, LINE, or PLANE",
  348. X      "-page geometry      size and location of the Postscript page",
  349. X      "-quality value      JPEG quality setting",
  350. X      "-scene value        image scene number",
  351. X      "-stereo             combine two images to form red-green stereo image",
  352. X      "-treedepth value    depth of the color classification tree",
  353. X      "-verbose            print detailed information about the image",
  354. X      (char *) NULL
  355. X    };
  356. X  (void) fprintf(stderr,
  357. X    "Usage: %s [options ...] input_file1 input_file2 output_file\n",
  358. X    client_name);
  359. X  (void) fprintf(stderr,"\nWhere options include:\n");
  360. X  for (p=options; *p != (char *) NULL; p++)
  361. X    (void) fprintf(stderr,"  %s\n",*p);
  362. X  (void) fprintf(stderr,
  363. X    "\nChange '-' to '+' in any option above to reverse its effect.  For\n");
  364. X  (void) fprintf(stderr,
  365. X    "example,  specify +alpha to store the image without an alpha channel.\n");
  366. X  exit(1);
  367. }
  368. X
  369. /*
  370. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  371. %                                                                             %
  372. %                                                                             %
  373. %                                                                             %
  374. %  M a i n                                                                    %
  375. %                                                                             %
  376. %                                                                             %
  377. %                                                                             %
  378. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  379. %
  380. %
  381. */
  382. int main(argc,argv)
  383. int
  384. X  argc;
  385. X
  386. char
  387. X  *argv[];
  388. {
  389. #define NotInitialized  (unsigned int) (~0)
  390. X
  391. X  char
  392. X    *border_color,
  393. X    *density,
  394. X    *filename,
  395. X    *font,
  396. X    *image_geometry,
  397. X    *option,
  398. X    *page_geometry,
  399. X    *server_name;
  400. X
  401. X  double
  402. X    normalized_maximum_error,
  403. X    normalized_mean_error;
  404. X
  405. X  Image
  406. X    *alpha_image,
  407. X    *beta_image,
  408. X    *combined_image;
  409. X
  410. X  ImageInfo
  411. X    image_info;
  412. X
  413. X  int
  414. X    i,
  415. X    status,
  416. X    x;
  417. X
  418. X  time_t
  419. X    start_time;
  420. X
  421. X  unsigned int
  422. X    alpha,
  423. X    colorspace,
  424. X    compose,
  425. X    compression,
  426. X    dither,
  427. X    interlace,
  428. X    mean_error_per_pixel,
  429. X    number_colors,
  430. X    quality,
  431. X    scene,
  432. X    stereo,
  433. X    tree_depth,
  434. X    verbose;
  435. X
  436. X  unsigned long
  437. X    total_colors;
  438. X
  439. X  /*
  440. X    Initialize program variables.
  441. X  */
  442. X  client_name=argv[0];
  443. X  if (argc < 4)
  444. X    Usage();
  445. X  /*
  446. X    Read image and convert to MIFF format.
  447. X  */
  448. X  alpha=NotInitialized;
  449. X  alpha_image=(Image *) NULL;
  450. X  border_color=(char *) NULL;
  451. X  beta_image=(Image *) NULL;
  452. X  colorspace=RGBColorspace;
  453. X  compose=OverCompositeOp;
  454. X  compression=UndefinedCompression;
  455. X  density=(char *) NULL;
  456. X  dither=False;
  457. X  font=(char *) NULL;
  458. X  image_geometry=(char *) NULL;
  459. X  interlace=NoneInterlace;
  460. X  number_colors=0;
  461. X  page_geometry=(char *) NULL;
  462. X  quality=75;
  463. X  scene=0;
  464. X  server_name=(char *) NULL;
  465. X  start_time=time((time_t *) NULL);
  466. X  stereo=False;
  467. X  tree_depth=0;
  468. X  verbose=False;
  469. X  /*
  470. X    Check command syntax.
  471. X  */
  472. X  filename=(char *) NULL;
  473. X  for (i=1; i < (argc-1); i++)
  474. X  {
  475. X    option=argv[i];
  476. X    if (((int) strlen(option) < 2) || ((*option != '-') && (*option != '+')))
  477. X      {
  478. X        /*
  479. X          Read input images.
  480. X        */
  481. X        filename=option;
  482. X        GetImageInfo(&image_info);
  483. X        (void) strcpy(image_info.filename,filename);
  484. X        image_info.server_name=server_name;
  485. X        image_info.font=font;
  486. X        image_info.geometry=image_geometry;
  487. X        image_info.page=page_geometry;
  488. X        image_info.density=density;
  489. X        image_info.border_color=border_color;
  490. X        image_info.interlace=interlace;
  491. X        image_info.quality=quality;
  492. X        image_info.verbose=verbose;
  493. X        if (alpha_image == (Image *) NULL)
  494. X          {
  495. X            alpha_image=ReadImage(&image_info);
  496. X            if (alpha_image == (Image *) NULL)
  497. X              exit(1);
  498. X            continue;
  499. X          }
  500. X        if (beta_image != (Image *) NULL)
  501. X          Error("input images already specified",filename);
  502. X        beta_image=ReadImage(&image_info);
  503. X        if (beta_image == (Image *) NULL)
  504. X          exit(1);
  505. X      }
  506. X    else
  507. X      switch(*(option+1))
  508. X      {
  509. X        case 'a':
  510. X        {
  511. X          alpha=(*option == '-');
  512. X          break;
  513. X        }
  514. X        case 'b':
  515. X        {
  516. X          if (strncmp("bordercolor",option+1,7) == 0)
  517. X            {
  518. X              border_color=(char *) NULL;
  519. X              if (*option == '-')
  520. X                {
  521. X                  i++;
  522. X                  if (i == argc)
  523. X                    Error("missing color on -bordercolor",(char *) NULL);
  524. X                  border_color=argv[i];
  525. X                }
  526. X              break;
  527. X            }
  528. X          break;
  529. X        }
  530. X        case 'c':
  531. X        {
  532. X          if (strncmp("colors",option+1,7) == 0)
  533. X            {
  534. X              number_colors=0;
  535. X              if (*option == '-')
  536. X                {
  537. X                  i++;
  538. X                  if ((i == argc) || !sscanf(argv[i],"%d",&x))
  539. X                    Error("missing colors on -colors",(char *) NULL);
  540. X                  number_colors=atoi(argv[i]);
  541. X                }
  542. X              break;
  543. X            }
  544. X          if (strncmp("colorspace",option+1,7) == 0)
  545. X            {
  546. X              colorspace=RGBColorspace;
  547. X              if (*option == '-')
  548. X                {
  549. X                  i++;
  550. X                  if (i == argc)
  551. X                    Error("missing type on -colorspace",(char *) NULL);
  552. X                  option=argv[i];
  553. X                  colorspace=UndefinedColorspace;
  554. X                  if (Latin1Compare("gray",option) == 0)
  555. X                    colorspace=GRAYColorspace;
  556. X                  if (Latin1Compare("rgb",option) == 0)
  557. X                    colorspace=RGBColorspace;
  558. X                  if (Latin1Compare("xyz",option) == 0)
  559. X                    colorspace=XYZColorspace;
  560. X                  if (Latin1Compare("ycbcr",option) == 0)
  561. X                    colorspace=YCbCrColorspace;
  562. X                  if (Latin1Compare("yiq",option) == 0)
  563. X                    colorspace=YIQColorspace;
  564. X                  if (Latin1Compare("yuv",option) == 0)
  565. X                    colorspace=YUVColorspace;
  566. X                  if (colorspace == UndefinedColorspace)
  567. X                    Error("invalid colorspace type on -colorspace",option);
  568. X                }
  569. X              break;
  570. X            }
  571. X          if (strncmp("compose",option+1,5) == 0)
  572. X            {
  573. X              compose=ReplaceCompositeOp;
  574. X              if (*option == '-')
  575. X                {
  576. X                  i++;
  577. X                  if (i == argc)
  578. X                    Error("missing type on -compose",(char *) NULL);
  579. X                  option=argv[i];
  580. X                  compose=UndefinedCompositeOp;
  581. X                  if (Latin1Compare("over",option) == 0)
  582. X                    compose=OverCompositeOp;
  583. X                  if (Latin1Compare("in",option) == 0)
  584. X                    compose=InCompositeOp;
  585. X                  if (Latin1Compare("out",option) == 0)
  586. X                    compose=OutCompositeOp;
  587. X                  if (Latin1Compare("atop",option) == 0)
  588. X                    compose=AtopCompositeOp;
  589. X                  if (Latin1Compare("xor",option) == 0)
  590. X                    compose=XorCompositeOp;
  591. X                  if (Latin1Compare("plus",option) == 0)
  592. X                    compose=PlusCompositeOp;
  593. X                  if (Latin1Compare("minus",option) == 0)
  594. X                    compose=MinusCompositeOp;
  595. X                  if (Latin1Compare("add",option) == 0)
  596. X                    compose=AddCompositeOp;
  597. X                  if (Latin1Compare("subtract",option) == 0)
  598. X                    compose=SubtractCompositeOp;
  599. X                  if (Latin1Compare("difference",option) == 0)
  600. X                    compose=DifferenceCompositeOp;
  601. X                  if (Latin1Compare("replace",option) == 0)
  602. X                    compose=ReplaceCompositeOp;
  603. X                  if (compose == UndefinedCompositeOp)
  604. X                    Error("invalid compose type on -compose",option);
  605. X                }
  606. X              break;
  607. X            }
  608. X          if (strncmp("compress",option+1,3) == 0)
  609. X            {
  610. X              compression=NoCompression;
  611. X              if (*option == '-')
  612. X                {
  613. X                  i++;
  614. X                  if (i == argc)
  615. X                    Error("missing type on -compress",(char *) NULL);
  616. X                  option=argv[i];
  617. X                  if (Latin1Compare("runlengthencoded",option) == 0)
  618. X                    compression=RunlengthEncodedCompression;
  619. X                  else
  620. X                    if (Latin1Compare("qencoded",option) == 0)
  621. X                      compression=QEncodedCompression;
  622. X                    else
  623. X                      Error("invalid compression type on -compress",option);
  624. X                }
  625. X              break;
  626. X            }
  627. X          Error("unrecognized option",option);
  628. X          break;
  629. X        }
  630. X        case 'd':
  631. X        {
  632. X          if (strncmp("density",option+1,3) == 0)
  633. X            {
  634. X              density=(char *) NULL;
  635. X              if (*option == '-')
  636. X                {
  637. X                  i++;
  638. X                  if (i == argc)
  639. X                    Error("missing geometry on -density",(char *) NULL);
  640. X                  density=argv[i];
  641. X                }
  642. X              break;
  643. X            }
  644. X          if (strncmp("display",option+1,3) == 0)
  645. X            {
  646. X              server_name=(char *) NULL;
  647. X              if (*option == '-')
  648. X                {
  649. X                  i++;
  650. X                  if (i == argc)
  651. X                    Error("missing server name on -display",(char *) NULL);
  652. X                  server_name=argv[i];
  653. X                }
  654. X              break;
  655. X            }
  656. X          if (strncmp("dither",option+1,3) == 0)
  657. X            {
  658. X              dither=(*option == '-');
  659. X              break;
  660. X            }
  661. X          Error("unrecognized option",option);
  662. X          break;
  663. X        }
  664. X        case 'f':
  665. X        {
  666. X          font=(char *) NULL;
  667. X          if (*option == '-')
  668. X            {
  669. X              i++;
  670. X              if (i == argc)
  671. X                Error("missing font name on -font",(char *) NULL);
  672. X              font=argv[i];
  673. X            }
  674. X          break;
  675. X        }
  676. X        case 'g':
  677. X        {
  678. X          image_geometry=(char *) NULL;
  679. X          if (*option == '-')
  680. X            {
  681. X              i++;
  682. X              if (i == argc)
  683. X                Error("missing geometry on -geometry",(char *) NULL);
  684. X              image_geometry=argv[i];
  685. X            }
  686. X          break;
  687. X        }
  688. X        case 'h':
  689. X        {
  690. X          Usage();
  691. X          break;
  692. X        }
  693. X        case 'i':
  694. X        {
  695. X          if (strncmp("interlace",option+1,3) == 0)
  696. X            {
  697. X              interlace=NoneInterlace;
  698. X              if (*option == '-')
  699. X                {
  700. X                  i++;
  701. X                  if (i == argc)
  702. X                    Error("missing type on -interlace",(char *) NULL);
  703. X                  option=argv[i];
  704. X                  interlace=UndefinedInterlace;
  705. X                  if (Latin1Compare("none",option) == 0)
  706. X                    interlace=NoneInterlace;
  707. X                  if (Latin1Compare("line",option) == 0)
  708. X                    interlace=LineInterlace;
  709. X                  if (Latin1Compare("plane",option) == 0)
  710. X                    interlace=PlaneInterlace;
  711. X                  if (interlace == UndefinedInterlace)
  712. X                    Error("invalid interlace type on -interlace",option);
  713. X                }
  714. X              break;
  715. X            }
  716. X          Error("unrecognized option",option);
  717. X          break;
  718. X        }
  719. X        case 'p':
  720. X        {
  721. X          if (strncmp("page",option+1,2) == 0)
  722. X            {
  723. X              page_geometry=(char *) NULL;
  724. X              if (*option == '-')
  725. X                {
  726. X                  i++;
  727. X                  if (i == argc)
  728. X                    Error("missing page geometry on -page",(char *) NULL);
  729. X                  page_geometry=argv[i];
  730. X                }
  731. X              break;
  732. X            }
  733. X          Error("unrecognized option",option);
  734. X          break;
  735. X        }
  736. X        case 'q':
  737. X        {
  738. X          i++;
  739. X          if ((i == argc) || !sscanf(argv[i],"%d",&x))
  740. X            Error("missing quality on -quality",(char *) NULL);
  741. X          quality=atoi(argv[i]);
  742. X          break;
  743. X        }
  744. X        case 's':
  745. X        {
  746. X          if (strncmp("scene",option+1,2) == 0)
  747. X            {
  748. X              scene=0;
  749. X              if (*option == '-')
  750. X                {
  751. X                  i++;
  752. X                  if ((i == argc) || !sscanf(argv[i],"%d",&x))
  753. X                    Error("missing scene number on -scene",(char *) NULL);
  754. X                  scene=atoi(argv[i]);
  755. X                }
  756. X              break;
  757. X            }
  758. X          if (strncmp("stereo",option+1,2) == 0)
  759. X            {
  760. X              stereo=(*option == '-');
  761. X              break;
  762. X            }
  763. X          Error("unrecognized option",option);
  764. X          break;
  765. X        }
  766. X        case 't':
  767. X        {
  768. X          tree_depth=0;
  769. X          if (*option == '-')
  770. X            {
  771. X              i++;
  772. X              if ((i == argc) || !sscanf(argv[i],"%d",&x))
  773. X                Error("missing depth on -treedepth",(char *) NULL);
  774. X              tree_depth=atoi(argv[i]);
  775. X            }
  776. X          break;
  777. X        }
  778. X        case 'v':
  779. X        {
  780. X          verbose=(*option == '-');
  781. X          break;
  782. X        }
  783. X        default:
  784. X        {
  785. X          Error("unrecognized option",option);
  786. X          break;
  787. X        }
  788. X      }
  789. X  }
  790. X  if ((alpha_image == (Image *) NULL) || (beta_image == (Image *) NULL))
  791. X    Usage();
  792. X  /*
  793. X    Combine image.
  794. X  */
  795. X  if (stereo)
  796. X    combined_image=StereoImage(alpha_image,beta_image);
  797. X  else
  798. X    {
  799. X      int
  800. X        x_offset,
  801. X        y_offset;
  802. X
  803. X      unsigned int
  804. X        size;
  805. X
  806. X      /*
  807. X        Digitally composite image.
  808. X      */
  809. X      x_offset=0;
  810. X      y_offset=0;
  811. X      if (image_info.geometry != (char *) NULL)
  812. X        (void) XParseGeometry(image_info.geometry,&x_offset,&y_offset,&size,
  813. X          &size);
  814. X      CompositeImage(beta_image,compose,alpha_image,x_offset,y_offset);
  815. X      combined_image=beta_image;
  816. X    }
  817. X  if (combined_image == (Image *) NULL)
  818. X    exit(1);
  819. X  /*
  820. X    Write image.
  821. X  */
  822. X  total_colors=0;
  823. X  if (alpha != NotInitialized)
  824. X    combined_image->alpha=alpha;
  825. X  if (compression != UndefinedCompression)
  826. X    combined_image->compression=compression;
  827. X  if (scene != 0)
  828. X    combined_image->scene=scene;
  829. X  (void) strcpy(combined_image->filename,argv[i]);
  830. X  if (colorspace == GRAYColorspace)
  831. X    QuantizeImage(combined_image,256,8,dither,GRAYColorspace,True);
  832. X  if (number_colors != 0)
  833. X    if ((combined_image->class == DirectClass) ||
  834. X        (combined_image->colors > number_colors))
  835. X      {
  836. X        /*
  837. X          Reduce the number of colors in the image.
  838. X        */
  839. X        QuantizeImage(combined_image,number_colors,tree_depth,dither,colorspace,
  840. X          True);
  841. X        if (verbose)
  842. X          {
  843. X            /*
  844. X              Measure quantization error.
  845. X            */
  846. X            QuantizationError(combined_image,&mean_error_per_pixel,
  847. X              &normalized_mean_error,&normalized_maximum_error);
  848. X            total_colors=NumberColors(combined_image,(FILE *) NULL);
  849. X          }
  850. X        SyncImage(combined_image);
  851. X      }
  852. X  status=WriteImage(&image_info,combined_image);
  853. X  if (verbose)
  854. X    {
  855. X      /*
  856. X        Display detailed info about the image.
  857. X      */
  858. X      (void) fprintf(stderr,"[%u] %s %s=>%s %ux%u",combined_image->scene,
  859. X        alpha_image->filename,filename,combined_image->filename,
  860. X        combined_image->columns,combined_image->rows);
  861. X      if (combined_image->class == DirectClass)
  862. X        (void) fprintf(stderr," DirectClass");
  863. X      else
  864. X        if (total_colors == 0)
  865. X          (void) fprintf(stderr," PseudoClass %uc",combined_image->colors);
  866. X        else
  867. X          {
  868. X            (void) fprintf(stderr," PseudoClass %lu=>%uc",total_colors,
  869. X              combined_image->colors);
  870. X            (void) fprintf(stderr," %u/%.6f/%.6fe",mean_error_per_pixel,
  871. X              normalized_mean_error,normalized_maximum_error);
  872. X          }
  873. X      (void) fprintf(stderr," %s %lds\n",combined_image->magick,
  874. X        time((time_t *) NULL)-start_time+1);
  875. X    }
  876. X  return(!status);
  877. }
  878. SHAR_EOF
  879. chmod 0644 ImageMagick/utilities/combine.c ||
  880. echo 'restore of ImageMagick/utilities/combine.c failed'
  881. Wc_c="`wc -c < 'ImageMagick/utilities/combine.c'`"
  882. test 23690 -eq "$Wc_c" ||
  883.     echo 'ImageMagick/utilities/combine.c: original size 23690, current size' "$Wc_c"
  884. rm -f _shar_wnt_.tmp
  885. fi
  886. # ============= ImageMagick/utilities/combine.man ==============
  887. if test -f 'ImageMagick/utilities/combine.man' -a X"$1" != X"-c"; then
  888.     echo 'x - skipping ImageMagick/utilities/combine.man (File already exists)'
  889.     rm -f _shar_wnt_.tmp
  890. else
  891. > _shar_wnt_.tmp
  892. echo 'x - extracting ImageMagick/utilities/combine.man (Text)'
  893. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/utilities/combine.man' &&
  894. .ad l
  895. .nh
  896. .TH combine 1 "10 January 1993" "ImageMagick"
  897. .SH NAME
  898. combine - combine images to create new images.
  899. .SH SYNOPSIS
  900. .B "combine"
  901. [ \fIoptions\fP ... ] \fIinput_file1\fP \fIinput_file2\fP \fIoutput_file\fP
  902. .SH DESCRIPTION
  903. \fBcombine\fP combine images to create new images.
  904. .SH EXAMPLES
  905. .PP
  906. To combine a image of a cockatoo with a perch, use
  907. .PP
  908. .B
  909. X     combine cockatoo.miff perch.ras composite.miff
  910. .PP
  911. To compute the difference between images in a series, use
  912. .PP
  913. .B
  914. X     combine -compose difference series.1 series.2 difference.miff
  915. .PP
  916. To combine a image of a cockatoo with a perch starting at location (100,150),
  917. use
  918. .PP
  919. .B
  920. X     combine -geometry +100+150 cockatoo.miff perch.ras composite.miff
  921. .SH OPTIONS
  922. .TP 5
  923. .B "-alpha"
  924. store alpha channel if the image has one.
  925. .TP 5
  926. .B "-colors \fIvalue\fP"
  927. preferred number of colors in the image.
  928. X
  929. The actual number of colors in the image may be less than your request,
  930. but never more.  Note, this is a color reduction option.  Images with
  931. less unique colors than specified with this option will remain unchanged.
  932. Refer to \fBquantize(9)\fP for more details.
  933. X
  934. Note, options \fB-dither\fP, \fB-colorspace\fP, and \fB-treedepth\fP affect
  935. the color reduction algorithm.
  936. .TP 5
  937. .B "-colorspace \fIvalue\fP"
  938. the type of colorspace: \fBGRAY\fP, \fBRGB\fP, \fBXYZ\fP, \fBYCbCr\fP,
  939. \fBYIQ\fP, or \fBYUV\fP.
  940. X
  941. Color reduction, by default, takes place in the RGB color space.
  942. Empirical evidence suggests that distances in color spaces such as YUV
  943. or YIQ correspond to perceptual color differences more closely
  944. than do distances in RGB space.  These color spaces may give better
  945. results when color reducing an image.  Refer to \fBquantize(9)\fP for
  946. more details.
  947. X
  948. The \fB-colors\fP or \fB-monochrome\fP option is required for this option
  949. to take effect.
  950. .TP 5
  951. .B "-compose \fIoperator\fP"
  952. the type of image composition.
  953. X
  954. By default, each of the composite image pixels are replaced by the
  955. cooresponding image tile pixel. You can choose an alternate composite
  956. operation:
  957. X
  958. X    over
  959. X    in
  960. X    out
  961. X    atop
  962. X    xor
  963. X    plus
  964. X    minus
  965. X    add
  966. X    subtract
  967. X    difference
  968. X    replace
  969. .PP
  970. The operations behaves as follows:
  971. .TP 9
  972. .B over
  973. The result will be the union of the two image shapes, with \fIimage\fP
  974. obscuring \fIcomposite image\fP in the region of overlap.
  975. .TP 9
  976. .B in
  977. The result is simply \fIimage\fP cut by the shape of \fIcomposite
  978. image\fP.  None of the image data of \fIcomposite image\fP will be in the
  979. result.
  980. .TP 9
  981. .B out
  982. The resulting image is \fIimage\fP with the shape of \fIcomposite image\fP
  983. cut out.
  984. .TP 9
  985. .B atop
  986. The result is the same shape as image \fIcomposite image\fP, with
  987. \fIimage\fP obscuring \fIcomposite image\fP where the image shapes
  988. overlap.  Note this differs from \fBover\fP because the portion of
  989. \fIimage\fP outside \fIcomposite image\fP's shape does not appear in the
  990. result.
  991. .TP 9
  992. .B xor
  993. The result is the image data from both \fIimage\fP and \fIcomposite image\fP
  994. that is outside the overlap region.  The overlap region will be blank.
  995. .TP 9
  996. .B plus
  997. The result is just the sum of the image data.  Output values are
  998. clipped to 255 (no overflow).  This operation is independent
  999. of the alpha channels.
  1000. .TP 9
  1001. .B minus
  1002. The result of \fIimage\fP \- \fIcomposite image\fP, with underflow clipped
  1003. to zero.  The alpha channel is ignored (set to 255, full coverage).
  1004. .TP 9
  1005. .B add
  1006. The result of \fIimage\fP + \fIcomposite image\fP, with overflow wrapping
  1007. around (\fImod\fP 256).
  1008. .TP 9
  1009. .B subtract
  1010. The result of \fIimage\fP - \fIcomposite image\fP, with underflow wrapping
  1011. around (\fImod\fP 256).  The \fBadd\fP and \fBsubtract\fP operators can
  1012. be used to perform reversible transformations.
  1013. .TP 9
  1014. .B difference
  1015. The result of abs(\fIimage\fP \- \fIcomposite image\fP).  This is useful
  1016. for comparing two very similar images.
  1017. .TP 9
  1018. .B replace
  1019. The resulting image is \fIcomposite image\fP replaced with \fIimage\fP.
  1020. Here the alpha information is ignored.
  1021. X
  1022. .TP 5
  1023. The image compositor requires an alpha, or matte channel in the image
  1024. for some operations.  This extra channel usually defines a mask which
  1025. represents a sort of a cookie-cutter for the image.  This is the case
  1026. when alpha is 255 (full coverage) for pixels inside the shape, zero
  1027. outside, and between zero and 255 on the boundary.  If \fIimage\fP does
  1028. not have an alpha channel, it is initialized with 0 for any pixel
  1029. matching in color to pixel location (0,0), otherwise 255 (to work
  1030. properly \fBborderwidth\fP must be 0).
  1031. .TP 5
  1032. .B "-compress \fItype\fP"
  1033. the type of image compression: \fIQEncoded\fP or \fIRunlengthEncoded\fP.
  1034. X
  1035. Specify \fB\+compress\fP to store the binary image in an uncompressed format.
  1036. The default is the compression type of the specified image file.
  1037. .TP 5
  1038. .B "-density \fI<width>x<height>
  1039. vertical and horizonal density of the image.
  1040. X
  1041. This option specifies an image density whose interpretation changes
  1042. with the type of image.  The default is 72 dots per inch in the
  1043. horizonal and vertical direction for Postscript.  Text files default to
  1044. 80 characters in width and 60 lines in height.  Use this option to
  1045. alter the default density.
  1046. .TP 5
  1047. .B "-display \fIhost:display[.screen]\fP"
  1048. specifies the X server to contact; see \fBX(1)\fP.
  1049. .TP 5
  1050. .B "-dither"
  1051. apply Floyd/Steinberg error diffusion to the image.
  1052. X
  1053. The basic strategy of dithering is to trade intensity resolution for
  1054. spatial resolution by averaging the intensities of several neighboring
  1055. pixels.  Images which suffer from severe contouring when reducing colors
  1056. can be improved with this option.
  1057. X
  1058. The \fB-colors\fP option is required for dithering to take effect.
  1059. .TP 5
  1060. .B "-font \fIname\fP"
  1061. This option specifies the font to be used  for displaying normal text.
  1062. The default is \fBfixed\fP.
  1063. .TP 5
  1064. .B "-geometry \fI<width>x<height>{\+-}<x offset>{\+-}<y offset>\fP"
  1065. the width and height of the image.  
  1066. X
  1067. Use this option to specified the width and height of raw images whose
  1068. dimensions are unknown such as \fBGRAY\fP, \fBRGB\fP, and \fBCMYK\fP.
  1069. This option can also change the default 8.5 by 11 width and height of
  1070. the Postscript canvas.
  1071. X
  1072. By default the images are combined relative to the top left corner,
  1073. location (0,0).  Use \fI<x offset>\fP and \fI<y offset>\fP to specify
  1074. a particular location to combine the images.
  1075. .TP 5
  1076. .B "-interlace \fItype\fP"
  1077. the type of interlacing scheme: \fBNONE\fP, \fBLINE\fP, or \fBPLANE\fP.
  1078. X
  1079. This option is used to specify the type of interlacing scheme for raw
  1080. image formats such as \fBRGB\fP or \fBYUV\fP.  \fBNONE\fP means do not
  1081. interlace (RGBRGBRGBRGBRGBRGB...), \fBLINE\fP uses scanline
  1082. interlacing (RRR...GGG...BBB...RRR...GGG...BBB...), and \fBPLANE\fP uses
  1083. plane interlacing (RRRRRR...GGGGGG...BBBBBB...).
  1084. .TP 5
  1085. .B "-page \fI<width>x<height>{\+-}<x offset>{\+-}<y offset>\fP"
  1086. preferred size and location of the Postscript page.
  1087. X
  1088. Use this option to specify the dimensions of the Postscript page in picas.  The
  1089. default is to center the image on a letter page, 612 by 792 picas.
  1090. Other common sizes are:
  1091. X
  1092. X    540x720   Note
  1093. X    612x1008  Legal
  1094. X    842x1190  A3
  1095. X    595x842   A4
  1096. X    421x595   A5
  1097. X    297x421   A6
  1098. X    709x1002  B4
  1099. X    612x936   U.S. Foolscap
  1100. X    612x936   European Foolscap
  1101. X    396x612   Half Letter
  1102. X    792x1224  11x17
  1103. X    1224x792  Ledger
  1104. X
  1105. The page geometry is relative to the vertical and horizonal density of the
  1106. Postscript page.  See \fB-density\fP for details.
  1107. .TP 5
  1108. .B "-quality \fIvalue\fP"
  1109. JPEG quality setting.
  1110. X
  1111. Quality is 0 (worst) to 100 (best). The default is 75.
  1112. .TP 5
  1113. .B "-scene \fIvalue\fP"
  1114. image scene number.
  1115. .TP 5
  1116. .B "-stereo"
  1117. combine two images into a red-green stereo image.
  1118. X
  1119. The left side of the stereo pair is saved as the red channel of the output
  1120. image.  The right sife is saved as the green channel.  Red-blue stereo
  1121. glasses are required to properly view the stereo image.
  1122. .TP 5
  1123. .B "-treedepth \fIvalue\fP"
  1124. Normally, this integer value is zero or one.  A zero or one tells
  1125. \fBcombine\fP to choose a optimal tree depth for the color reduction
  1126. algorithm.
  1127. X
  1128. An optimal depth generally allows the best representation of the source
  1129. image with the fastest computational speed and the least amount of
  1130. memory.  However, the default depth is inappropriate for some images.
  1131. To assure the best representation, try values between 2 and 8 for this
  1132. parameter.  Refer to \fBquantize(9)\fP for more details.
  1133. X
  1134. The \fB-colors\fP option is required for this option to take effect.
  1135. .TP 5
  1136. .B -verbose
  1137. print detailed information about the image.
  1138. X
  1139. This information is printed: image scene number;  image name;  combined
  1140. image name;  image size;  the image class (\fIDirectClass\fP or 
  1141. \fIPseudoClass\fP);  the total number of unique colors;  and the number
  1142. of seconds to read and combine the image.
  1143. .PP
  1144. Change '-' to '+' in any option above to reverse its effect.  For
  1145. example, specify +alpha to store the image without its alpha channel.
  1146. .PP
  1147. By default, the image format is determined by its magic number. To
  1148. specify a particular image format, precede the filename with an image
  1149. format name and a colon (i.e. ps:image) or specify the image type as
  1150. the filename suffix (i.e. image.ps).  See \fBconvert(1)\fP for a list
  1151. of valid image formats.
  1152. .PP
  1153. When you specify \fBX\fP as your image type, the filename has special
  1154. meaning.  It specifies an X window by id, name, or \fBroot\fP.  If no
  1155. filename is specified, the window is selected by clicking the mouse in
  1156. the desired window.
  1157. .PP
  1158. Specify \fIinput_file\fP as \fI-\fP for standard input,
  1159. \fIoutput_file\fP as \fI-\fP for standard output.  If \fIinput_file\fP
  1160. has the extension \fB.Z\fP or \fB.gz\fP, the file is uncompressed with
  1161. \fBuncompress\fP or \fBgunzip\fP respectively.  If \fIoutput_file\fP
  1162. has the extension \fB.Z\fP or \fB.gz\fP, the file size is compressed
  1163. using with \fBcompress\fP or \fBgzip\fP respectively.  If
  1164. \fIoutput_file\fP already exists, you will be prompted as to whether it
  1165. should be overwritten.
  1166. .SH ENVIRONMENT
  1167. .PP
  1168. .TP 5
  1169. .B display
  1170. To get the default host, display number, and screen.
  1171. .SH SEE ALSO
  1172. .B
  1173. display(1), animate(1), mogrify(1), quantize(9), X(1), miff(5)
  1174. .SH COPYRIGHT
  1175. Copyright 1993 E. I. du Pont de Nemours & Company
  1176. .PP
  1177. Permission to use, copy, modify, distribute, and sell this software and
  1178. its documentation for any purpose is hereby granted without fee,
  1179. provided that the above copyright notice appear in all copies and that
  1180. both that copyright notice and this permission notice appear in
  1181. supporting documentation, and that the name of E. I. du Pont de Nemours
  1182. & Company not be used in advertising or publicity pertaining to
  1183. distribution of the software without specific, written prior
  1184. permission.  E. I. du Pont de Nemours & Company makes no representations
  1185. about the suitability of this software for any purpose.  It is provided
  1186. "as is" without express or implied warranty.
  1187. .PP
  1188. E. I. du Pont de Nemours & Company disclaims all warranties with regard
  1189. to this software, including all implied warranties of merchantability
  1190. and fitness, in no event shall E. I. du Pont de Nemours & Company be
  1191. liable for any special, indirect or consequential damages or any
  1192. damages whatsoever resulting from loss of use, data or profits, whether
  1193. in an action of contract, negligence or other tortious action, arising
  1194. out of or in connection with the use or performance of this software.
  1195. .SH AUTHORS
  1196. John Cristy, E.I. du Pont De Nemours & Company Incorporated
  1197. SHAR_EOF
  1198. chmod 0644 ImageMagick/utilities/combine.man ||
  1199. echo 'restore of ImageMagick/utilities/combine.man failed'
  1200. Wc_c="`wc -c < 'ImageMagick/utilities/combine.man'`"
  1201. test 11289 -eq "$Wc_c" ||
  1202.     echo 'ImageMagick/utilities/combine.man: original size 11289, current size' "$Wc_c"
  1203. rm -f _shar_wnt_.tmp
  1204. fi
  1205. # ============= ImageMagick/utilities/segment.c ==============
  1206. if test -f 'ImageMagick/utilities/segment.c' -a X"$1" != X"-c"; then
  1207.     echo 'x - skipping ImageMagick/utilities/segment.c (File already exists)'
  1208.     rm -f _shar_wnt_.tmp
  1209. else
  1210. > _shar_wnt_.tmp
  1211. echo 'x - extracting ImageMagick/utilities/segment.c (Text)'
  1212. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/utilities/segment.c' &&
  1213. /*
  1214. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1215. %                                                                             %
  1216. %                                                                             %
  1217. %                                                                             %
  1218. %               SSSSS  EEEEE   GGGG  M   M  EEEEE  N   N  TTTTT               %
  1219. %               SS     E      G      MM MM  E      NN  N    T                 %
  1220. %                SSS   EEE    G GGG  M M M  EEE    N N N    T                 %
  1221. %                  SS  E      G   G  M   M  E      N  NN    T                 %
  1222. %               SSSSS  EEEEE   GGGG  M   M  EEEEE  N   N    T                 %
  1223. %                                                                             %
  1224. %                                                                             %
  1225. %     Segment an Image with Thresholding and the Fuzzy c-Means Technique.     %
  1226. %                                                                             %
  1227. %                                                                             %
  1228. %                                                                             %
  1229. %                              Software Design                                %
  1230. %                                John Cristy                                  %
  1231. %                                April 1993                                   %
  1232. %                                                                             %
  1233. %                                                                             %
  1234. %  Copyright 1993 E. I. Dupont de Nemours & Company                           %
  1235. %                                                                             %
  1236. %  Permission to use, copy, modify, distribute, and sell this software and    %
  1237. %  its documentation for any purpose is hereby granted without fee,           %
  1238. %  provided that the above Copyright notice appear in all copies and that     %
  1239. %  both that Copyright notice and this permission notice appear in            %
  1240. %  supporting documentation, and that the name of E. I. Dupont de Nemours     %
  1241. %  & Company not be used in advertising or publicity pertaining to            %
  1242. %  distribution of the software without specific, written prior               %
  1243. %  permission.  E. I. Dupont de Nemours & Company makes no representations    %
  1244. %  about the suitability of this software for any purpose.  It is provided    %
  1245. %  "as is" without express or implied warranty.                               %
  1246. %                                                                             %
  1247. %  E. I. Dupont de Nemours & Company disclaims all warranties with regard     %
  1248. %  to this software, including all implied warranties of merchantability      %
  1249. %  and fitness, in no event shall E. I. Dupont de Nemours & Company be        %
  1250. %  liable for any special, indirect or consequential damages or any           %
  1251. %  damages whatsoever resulting from loss of use, data or profits, whether    %
  1252. %  in an action of contract, negligence or other tortious action, arising     %
  1253. %  out of or in connection with the use or performance of this software.      %
  1254. %                                                                             %
  1255. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1256. %
  1257. %  Segment segments an image by analyzing the histograms of the color
  1258. %  components and identifying units that are homogeneous with the fuzzy
  1259. %  c-means technique.  The scale-space filter analyzes the histograms of
  1260. %  the three color components of the image and identifies a set of classes.
  1261. %  The extents of each class is used to coarsely segment the image with
  1262. %  thresholding.  The color associated with each class is determined by
  1263. %  the mean color of all pixels within the extents of a particular class.
  1264. %  Finally, any unclassified pixels are assigned to the closest class with
  1265. %  the fuzzy c-means technique.
  1266. %
  1267. %  The fuzzy c-Means algorithm can be summarized as follows:
  1268. %
  1269. %    o Build a histogram, one for each color component of the image.
  1270. %
  1271. %    o For each histogram, successively apply the scale-space
  1272. %      filter and build an interval tree of zero crossings in
  1273. %      the second derivative at each scale.  Analyze this
  1274. %      scale-space ``fingerprint'' to determine which peaks and
  1275. %      valleys in the histogram are most predominant.
  1276. %
  1277. %    o The fingerprint defines intervals on the axis of the
  1278. %      histogram.  Each interval contains either a minima or a
  1279. %      maxima in the original signal.  If each color component
  1280. %      lies within the maxima interval, that pixel is considered
  1281. %      ``classified'' and is assigned an unique class number.
  1282. %
  1283. %    o Any pixel that fails to be classified in the above
  1284. %      thresholding pass is classified using the fuzzy
  1285. %      c-Means technique.  It is assigned to one of the classes
  1286. %      discovered in the histogram analysis phase.
  1287. %
  1288. %  The fuzzy c-Means technique attempts to cluster a pixel by finding
  1289. %  the local minima of the generalized within group sum of squared error
  1290. %  objective function.  A pixel is assigned to the closest class of which
  1291. %  the fuzzy membership has a maximum value.
  1292. %
  1293. %  Segment is strongly based on software written by Andy Gallo, University
  1294. %  of Delaware.
  1295. %
  1296. %  The following reference was used in creating this program:
  1297. %
  1298. %    Young Won Lim, Sang Uk Lee, "On The Color Image Segmentation Algorithm
  1299. %    Based on the Thresholding and the Fuzzy c-Means Techniques", Pattern
  1300. %    Recognition, Volume 23, Number 9, pages 935-952, 1990.
  1301. %
  1302. %  The segment program syntax is:
  1303. %
  1304. %  Usage: segment [options ...] input_file output_file
  1305. %
  1306. %  Where options include:
  1307. %    -alpha              store alpha channel if the image has one
  1308. %    -colorspace type    GRAY, RGB, XYZ, YCbCr, YIQ, or YUV
  1309. %    -compress type      RunlengthEncoded or QEncoded
  1310. %    -density geometry   vertical and horizonal density of the image
  1311. SHAR_EOF
  1312. true || echo 'restore of ImageMagick/utilities/segment.c failed'
  1313. fi
  1314. echo 'End of ImageMagick part 3'
  1315. echo 'File ImageMagick/utilities/segment.c is continued in part 4'
  1316. echo 4 > _shar_seq_.tmp
  1317. exit 0
  1318.  
  1319. exit 0 # Just in case...
  1320. -- 
  1321.   // chris@Sterling.COM           | Send comp.sources.x submissions to:
  1322. \X/  Amiga - The only way to fly! |    sources-x@sterling.com
  1323.  "It's intuitively obvious to the |
  1324.   most casual observer..."        | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
  1325.