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

  1. Newsgroups: comp.sources.x
  2. From: cristy@eplrx7.es.duPont.com (Cristy)
  3. Subject: v20i058:  imagemagic - X11 image processing and display, Part02/38
  4. Message-ID: <1993Jul14.175231.630@sparky.sterling.com>
  5. X-Md4-Signature: 7f31abd84be4aca6e0ea850ba5b2c8f7
  6. Sender: chris@sparky.sterling.com (Chris Olson)
  7. Organization: Sterling Software
  8. Date: Wed, 14 Jul 1993 17:52:31 GMT
  9. Approved: chris@sterling.com
  10.  
  11. Submitted-by: cristy@eplrx7.es.duPont.com (Cristy)
  12. Posting-number: Volume 20, Issue 58
  13. Archive-name: imagemagic/part02
  14. Environment: X11
  15. Supersedes: imagemagic: Volume 13, Issue 17-37
  16.  
  17. #!/bin/sh
  18. # this is magick.02 (part 2 of ImageMagick)
  19. # do not concatenate these parts, unpack them in order with /bin/sh
  20. # file ImageMagick/utilities/Makefile 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" != 2; 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/Makefile'
  36. else
  37. echo 'x - continuing file ImageMagick/utilities/Makefile'
  38. sed 's/^X//' << 'SHAR_EOF' >> 'ImageMagick/utilities/Makefile' &&
  39. #JPEG_LIBRARIES= -L$(TOP)/jpeg -ljpeg
  40. #TIFF_DEFINES= -DHasTIFF
  41. #TIFF_INCLUDES= -I$(TOP)/tiff/libtiff
  42. #TIFF_LIBRARIES= -L$(TOP)/tiff/libtiff -ltiff
  43. X
  44. XXLIB= -L/usr/lib/X11R5 -lX11
  45. X
  46. CC= cc -O -I/usr/include/X11R5
  47. DESTDIR= /usr/local/bin
  48. INSTALL = install -c
  49. RM= /bin/rm -f
  50. X
  51. DEFINES= -I.. $(JPEG_DEFINES) $(JPEG_INCLUDES) $(TIFF_DEFINES) $(TIFF_INCLUDES)
  52. SYS_LIBRARIES= $(XLIB) $(JPEG_LIBRARIES) $(TIFF_LIBRARIES) -lm
  53. X
  54. MagickObjects= ../X.o ../image.o ../shear.o ../quantize.o ../colors.o \
  55. X  ../signature.o ../decode.o ../encode.o ../compress.o ../utility.o \
  56. X  ../PreRvIcccm.o
  57. X
  58. CombineObjects= combine.o $(MagickObjects)
  59. ConvertObjects= convert.o $(MagickObjects)
  60. MogrifyObjects= mogrify.o $(MagickObjects)
  61. SegmentObjects= segment.o $(MagickObjects)
  62. X
  63. PROGRAMS= convert mogrify combine segment
  64. X
  65. CFLAGS= $(DEFINES)
  66. X
  67. all: $(PROGRAMS)
  68. X
  69. convert: $(ConvertObjects)
  70. X    $(RM) $@
  71. X    $(CC) -o $@ $(ConvertObjects) $(SYS_LIBRARIES)
  72. X
  73. clean::
  74. X    $(RM) convert
  75. X
  76. install:: convert
  77. X    $(INSTALL) convert $(DESTDIR)
  78. X
  79. mogrify: $(MogrifyObjects)
  80. X    $(RM) $@
  81. X    $(CC) -o $@ $(MogrifyObjects) $(SYS_LIBRARIES)
  82. X
  83. clean::
  84. X    $(RM) mogrify
  85. X
  86. install:: mogrify
  87. X    $(INSTALL) mogrify $(DESTDIR)
  88. X
  89. combine: $(CombineObjects)
  90. X    $(RM) $@
  91. X    $(CC) -o $@ $(CombineObjects) $(SYS_LIBRARIES)
  92. X
  93. clean::
  94. X    $(RM) combine
  95. X
  96. install:: combine
  97. X    $(INSTALL) combine $(DESTDIR)
  98. X
  99. segment: $(SegmentObjects)
  100. X    $(RM) $@
  101. X    $(CC) -o $@ $(SegmentObjects) $(SYS_LIBRARIES)
  102. X
  103. clean::
  104. X    $(RM) segment
  105. X
  106. install:: segment
  107. X    $(INSTALL) segment $(DESTDIR)
  108. X
  109. clean::
  110. X    $(RM) *.ln *.bak *.o core errs ,* *~ *.a .emacs_* make.log MakeOut
  111. SHAR_EOF
  112. echo 'File ImageMagick/utilities/Makefile is complete' &&
  113. chmod 0644 ImageMagick/utilities/Makefile ||
  114. echo 'restore of ImageMagick/utilities/Makefile failed'
  115. Wc_c="`wc -c < 'ImageMagick/utilities/Makefile'`"
  116. test 3074 -eq "$Wc_c" ||
  117.     echo 'ImageMagick/utilities/Makefile: original size 3074, current size' "$Wc_c"
  118. rm -f _shar_wnt_.tmp
  119. fi
  120. # ============= ImageMagick/utilities/convert.c ==============
  121. if test -f 'ImageMagick/utilities/convert.c' -a X"$1" != X"-c"; then
  122.     echo 'x - skipping ImageMagick/utilities/convert.c (File already exists)'
  123.     rm -f _shar_wnt_.tmp
  124. else
  125. > _shar_wnt_.tmp
  126. echo 'x - extracting ImageMagick/utilities/convert.c (Text)'
  127. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/utilities/convert.c' &&
  128. /*
  129. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  130. %                                                                             %
  131. %                                                                             %
  132. %                                                                             %
  133. %                CCCC   OOO   N   N  V   V  EEEEE  RRRR   TTTTT               %
  134. %               C      O   O  NN  N  V   V  E      R   R    T                 %
  135. %               C      O   O  N N N  V   V  EEE    RRRR     T                 %
  136. %               C      O   O  N  NN   V V   E      R R      T                 %
  137. %                CCCC   OOO   N   N    V    EEEEE  R  R     T                 %
  138. %                                                                             %
  139. %                                                                             %
  140. %                 Convert a image from one format to another.                 %
  141. %                                                                             %
  142. %                                                                             %
  143. %                                                                             %
  144. %                              Software Design                                %
  145. %                                John Cristy                                  %
  146. %                                April 1992                                   %
  147. %                                                                             %
  148. %                                                                             %
  149. %  Copyright 1993 E. I. Dupont de Nemours & Company                           %
  150. %                                                                             %
  151. %  Permission to use, copy, modify, distribute, and sell this software and    %
  152. %  its documentation for any purpose is hereby granted without fee,           %
  153. %  provided that the above Copyright notice appear in all copies and that     %
  154. %  both that Copyright notice and this permission notice appear in            %
  155. %  supporting documentation, and that the name of E. I. Dupont de Nemours     %
  156. %  & Company not be used in advertising or publicity pertaining to            %
  157. %  distribution of the software without specific, written prior               %
  158. %  permission.  E. I. Dupont de Nemours & Company makes no representations    %
  159. %  about the suitability of this software for any purpose.  It is provided    %
  160. %  "as is" without express or implied warranty.                               %
  161. %                                                                             %
  162. %  E. I. Dupont de Nemours & Company disclaims all warranties with regard     %
  163. %  to this software, including all implied warranties of merchantability      %
  164. %  and fitness, in no event shall E. I. Dupont de Nemours & Company be        %
  165. %  liable for any special, indirect or consequential damages or any           %
  166. %  damages whatsoever resulting from loss of use, data or profits, whether    %
  167. %  in an action of contract, negligence or other tortious action, arising     %
  168. %  out of or in connection with the use or performance of this software.      %
  169. %                                                                             %
  170. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  171. %
  172. %  Convert converts an input file using one image format to an output file
  173. %  with a differing image format.
  174. %
  175. %  Convert recognizes the following image formats:
  176. %
  177. %    Tag   Description
  178. %    ---------------------------------------------------
  179. %    ALPHA Raw alpha bytes.
  180. %    AVS   AVS X image file.
  181. %    BMP   Microsoft Windows bitmap image file.
  182. %    CMYK  Raw cyan, magenta, yellow, and black bytes.
  183. %    EPS   Adobe Encapsulated PostScript file.
  184. %    FAX   Group 3.
  185. %    GIF   Compuserve Graphics image file.
  186. %    GRAY  Raw gray bytes.
  187. %    HISTOGRAM
  188. %    IRIS  SGI RGB image file.
  189. %    JPEG
  190. %    MIFF  Machine Independant file format.
  191. %    MTV
  192. %    PCX       ZSoft IBM PC Paintbrush file
  193. %    PICT  Apple Macintosh QuickDraw/PICT file.
  194. %    PNM   Portable bitmap.
  195. %    PS    Adobe PostScript file.
  196. %    PS2   Adobe Level II PostScript file.
  197. %    RGB   Raw red, green, and blue bytes.
  198. %    RLE   Utah Run length encoded image file; read only.
  199. %    SUN   SUN Rasterfile.
  200. %    TEXT  raw text file; read only.
  201. %    TGA   Truevision Targa image file.
  202. %    TIFF  Tagged Image File Format.
  203. %    VICAR read only.
  204. %    VIFF  Khoros Visualization image file.
  205. %    X     select image from X server screen.
  206. %    XC    constant image of X server border color.
  207. %    XBM   X11 bitmap file.
  208. %    XWD   X Window System window dump image file.
  209. %    YUV   Raw Y, U, and V bytes.  U and V, normally -0.5 through
  210. %          0.5, are normalized to the range 0 through 255 to fit
  211. %          within a byte.
  212. %
  213. %  The convert program syntax is:
  214. %
  215. %  Usage: convert [options ...] input_file output_file
  216. %
  217. %  Where options include:
  218. %    -alpha              store alpha channel if the image has one
  219. %    -colors value       preferred number of colors in the image
  220. %    -clip geometry      preferred size and location of the clipped image
  221. %    -colorspace type    GRAY, RGB, XYZ, YCbCr, YIQ, or YUV
  222. %    -compress type      RunlengthEncoded or QEncoded
  223. %    -density geometry   vertical and horizonal density of the image
  224. %    -display server     obtain image or font from this X server
  225. %    -dither             apply Floyd/Steinberg error diffusion to image
  226. %    -font name          X11 font for displaying text
  227. %    -geometry geometry  width and height of the image
  228. %    -interlace type     NONE, LINE, or PLANE
  229. %    -monochrome         transform image to black and white
  230. %    -page geometry      size and location of the Postscript page
  231. %    -quality value      JPEG quality setting
  232. %    -scale geometry     preferred size factors of the image
  233. %    -scene value        image scene number
  234. %    -treedepth value    depth of the color classification tree
  235. %    -verbose            print detailed information about the image
  236. %
  237. %  Change '-' to '+' in any option above to reverse its effect.  For
  238. %  example,  specify +alpha to store the image without its alpha channel.
  239. %
  240. %  By default, the image format of `file' is determined by its magic
  241. %  number.  To specify a particular image format, precede the filename
  242. %  with an image format name and a colon (i.e. ps:image) or specify the
  243. %  image type as the filename suffix (i.e. image.ps).  Specify 'file' as
  244. %  '-' for standard input or output.
  245. %
  246. %
  247. */
  248. X
  249. #include "display.h"
  250. #include "image.h"
  251. #include "X.h"
  252. X
  253. /*
  254. X  Global declarations.
  255. */
  256. char
  257. X  *client_name;
  258. X
  259. /*
  260. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  261. %                                                                             %
  262. %                                                                             %
  263. %                                                                             %
  264. %   E r r o r                                                                 %
  265. %                                                                             %
  266. %                                                                             %
  267. %                                                                             %
  268. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  269. %
  270. %  Function Error displays an error message and then terminates the program.
  271. %
  272. %  The format of the Error routine is:
  273. %
  274. %      Error(message,qualifier)
  275. %
  276. %  A description of each parameter follows:
  277. %
  278. %    o message: Specifies the message to display before terminating the
  279. %      program.
  280. %
  281. %    o qualifier: Specifies any qualifier to the message.
  282. %
  283. %
  284. */
  285. void Error(message,qualifier)
  286. char
  287. X  *message,
  288. X  *qualifier;
  289. {
  290. X  (void) fprintf(stderr,"%s: %s",client_name,message);
  291. X  if (qualifier != (char *) NULL)
  292. X    (void) fprintf(stderr," (%s)",qualifier);
  293. X  (void) fprintf(stderr,".\n");
  294. X  exit(1);
  295. }
  296. X
  297. /*
  298. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  299. %                                                                             %
  300. %                                                                             %
  301. %                                                                             %
  302. %   U s a g e                                                                 %
  303. %                                                                             %
  304. %                                                                             %
  305. %                                                                             %
  306. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  307. %
  308. %  Procedure Usage displays the program usage;
  309. %
  310. %  The format of the Usage routine is:
  311. %
  312. %      Usage()
  313. %
  314. %
  315. */
  316. static void Usage()
  317. {
  318. X  char
  319. X    **p;
  320. X
  321. X  static char
  322. X    *ImageTypes[]=
  323. X    {
  324. X      "Tag   Description",
  325. X      "------------------------------------------------------------",
  326. X      "ALPHA Raw alpha bytes.",
  327. X      "AVS   AVS X image file.",
  328. X      "BMP   Microsoft Windows bitmap image file.",
  329. X      "CMYK  Raw cyan, magenta, yellow, and black bytes.",
  330. X      "EPS   Adobe Encapsulated PostScript file.",
  331. X      "FAX   Group 3.",
  332. X      "GIF   Compuserve Graphics image file.",
  333. X      "GRAY  Raw gray bytes.",
  334. X      "HISTOGRAM",
  335. X      "IRIS  SGI RGB image file.",
  336. X      "JPEG",
  337. X      "MIFF  Machine Independant file format.",
  338. X      "MTV",
  339. X      "PCX   ZSoft IBM PC Paintbrush file.",
  340. X      "PICT  Apple Macintosh QuickDraw/PICT file.",
  341. X      "PNM   Portable bitmap.",
  342. X      "PS    Adobe PostScript file.",
  343. X      "PS2   Adobe Level II PostScript file.",
  344. X      "RGB   Raw red, green, and blue bytes.",
  345. X      "RLE   Utah Run length encoded image file; read only.",
  346. X      "SUN   SUN Rasterfile.",
  347. X      "TEXT  raw text file; read only.",
  348. X      "TGA   Truevision Targa image file.",
  349. X      "TIFF  Tagged Image File Format.",
  350. X      "VICAR read only.",
  351. X      "VIFF  Khoros Visualization image file.",
  352. X      "X     select image from X server screen.",
  353. X      "XC    constant image of X server border color.",
  354. X      "XBM   X11 bitmap file.",
  355. X      "XWD   X Window System window dump image file.",
  356. X      "YUV   Raw Y, U, and V bytes.  U and V, normally -0.5 through",
  357. X      "      0.5, are normalized to the range 0 through 255 to fit",
  358. X      "      within a byte.",
  359. X      (char *) NULL,
  360. X    },
  361. X    *options[]=
  362. X    {
  363. X      "-alpha              store alpha channel if the image has one",
  364. X      "-clip geometry      preferred size and location of the clipped image",
  365. X      "-colors value       preferred number of colors in the image",
  366. X      "-colorspace type    GRAY, RGB, XYZ, YCbCr, YIQ, or YUV",
  367. X      "-compress type      RunlengthEncoded or QEncoded",
  368. X      "-density geometry   vertical and horizonal density of the image",
  369. X      "-display server     obtain image or font from this X server",
  370. X      "-dither             apply Floyd/Steinberg error diffusion to image",
  371. X      "-font name          X11 font for displaying text",
  372. X      "-geometry geometry  width and height of the image",
  373. X      "-interlace type     NONE, LINE, or PLANE",
  374. X      "-monochrome         transform image to black and white",
  375. X      "-page geometry      size and location of the Postscript page",
  376. X      "-quality value      JPEG quality setting",
  377. X      "-scale geometry     preferred size factors of the image",
  378. X      "-scene value        image scene number",
  379. X      "-treedepth value    depth of the color classification tree",
  380. X      "-verbose            print detailed information about the image",
  381. X      (char *) NULL
  382. X    };
  383. X  (void) fprintf(stderr,"Usage: %s [options ...] input_file output_file\n",
  384. X    client_name);
  385. X  (void) fprintf(stderr,"\nWhere options include:\n");
  386. X  for (p=options; *p != (char *) NULL; p++)
  387. X    (void) fprintf(stderr,"  %s\n",*p);
  388. X  (void) fprintf(stderr,
  389. X    "\nChange '-' to '+' in any option above to reverse its effect.  For\n");
  390. X  (void) fprintf(stderr,
  391. X    "example,  specify +alpha to store the image without an alpha channel.\n");
  392. X  (void) fprintf(stderr,
  393. X    "\nBy default, the image format of `file' is determined by its magic\n");
  394. X  (void) fprintf(stderr,
  395. X    "number.  To specify a particular image format, precede the filename\n");
  396. X  (void) fprintf(stderr,
  397. X    "with an image format name and a colon (i.e. ps:image) or specify the\n");
  398. X  (void) fprintf(stderr,
  399. X    "image type as the filename suffix (i.e. image.ps).  Specify 'file' as\n");
  400. X  (void) fprintf(stderr,"'-' for standard input or output.\n");
  401. X  (void) fprintf(stderr,"\nThe following image formats are recognized: \n\n");
  402. X  for (p=ImageTypes; *p != (char *) NULL; p++)
  403. X    (void) fprintf(stderr,"  %s\n",*p);
  404. X  exit(1);
  405. }
  406. X
  407. /*
  408. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  409. %                                                                             %
  410. %                                                                             %
  411. %                                                                             %
  412. %  M a i n                                                                    %
  413. %                                                                             %
  414. %                                                                             %
  415. %                                                                             %
  416. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  417. %
  418. %
  419. */
  420. int main(argc,argv)
  421. int
  422. X  argc;
  423. X
  424. char
  425. X  *argv[];
  426. {
  427. #define NotInitialized  (unsigned int) (~0)
  428. X
  429. X  char
  430. X    *border_color,
  431. X    *clip_geometry,
  432. X    *density,
  433. X    *filename,
  434. X    *font,
  435. X    *image_geometry,
  436. X    *option,
  437. X    *page_geometry,
  438. X    *scale_geometry,
  439. X    *server_name;
  440. X
  441. X  double
  442. X    normalized_maximum_error,
  443. X    normalized_mean_error;
  444. X
  445. X  Image
  446. X    *image,
  447. X    *next_image;
  448. X
  449. X  ImageInfo
  450. X    image_info;
  451. X
  452. X  int
  453. X    i,
  454. X    status,
  455. X    x;
  456. X
  457. X  time_t
  458. X    start_time;
  459. X
  460. X  unsigned int
  461. X    alpha,
  462. X    colorspace,
  463. X    compression,
  464. X    dither,
  465. X    interlace,
  466. X    monochrome,
  467. X    mean_error_per_pixel,
  468. X    number_colors,
  469. X    quality,
  470. X    scene,
  471. X    tree_depth,
  472. X    verbose;
  473. X
  474. X  unsigned long
  475. X    total_colors;
  476. X
  477. X  /*
  478. X    Initialize program variables.
  479. X  */
  480. X  client_name=argv[0];
  481. X  if (argc < 3)
  482. X    Usage();
  483. X  /*
  484. X    Read image and convert to MIFF format.
  485. X  */
  486. X  alpha=NotInitialized;
  487. X  border_color=(char *) NULL;
  488. X  clip_geometry=(char *) NULL;
  489. X  colorspace=RGBColorspace;
  490. X  compression=UndefinedCompression;
  491. X  density=(char *) NULL;
  492. X  dither=False;
  493. X  font=(char *) NULL;
  494. X  image=(Image *) NULL;
  495. X  image_geometry=(char *) NULL;
  496. X  interlace=NoneInterlace;
  497. X  monochrome=False;
  498. X  number_colors=0;
  499. X  page_geometry=(char *) NULL;
  500. X  quality=75;
  501. X  scale_geometry=(char *) NULL;
  502. X  scene=0;
  503. X  server_name=(char *) NULL;
  504. X  start_time=time((time_t *) NULL);
  505. X  tree_depth=0;
  506. X  verbose=False;
  507. X  /*
  508. X    Check command syntax.
  509. X  */
  510. X  filename=(char *) NULL;
  511. X  for (i=1; i < (argc-1); i++)
  512. X  {
  513. X    option=argv[i];
  514. X    if (((int) strlen(option) < 2) || ((*option != '-') && (*option != '+')))
  515. X      {
  516. X        /*
  517. X          Read input image.
  518. X        */
  519. X        filename=option;
  520. X        GetImageInfo(&image_info);
  521. X        (void) strcpy(image_info.filename,filename);
  522. X        image_info.server_name=server_name;
  523. X        image_info.font=font;
  524. X        image_info.geometry=image_geometry;
  525. X        image_info.page=page_geometry;
  526. X        image_info.density=density;
  527. X        image_info.border_color=border_color;
  528. X        image_info.interlace=interlace;
  529. X        image_info.monochrome=monochrome;
  530. X        image_info.quality=quality;
  531. X        image_info.verbose=verbose;
  532. X        if (image != (Image *) NULL)
  533. X          Error("input image already specified",filename);
  534. X        image=ReadImage(&image_info);
  535. X        if (image == (Image *) NULL)
  536. X          exit(1);
  537. X      }
  538. X    else
  539. X      switch(*(option+1))
  540. X      {
  541. X        case 'a':
  542. X        {
  543. X          alpha=(*option == '-');
  544. X          break;
  545. X        }
  546. X        case 'b':
  547. X        {
  548. X          if (strncmp("bordercolor",option+1,7) == 0)
  549. X            {
  550. X              border_color=(char *) NULL;
  551. X              if (*option == '-')
  552. X                {
  553. X                  i++;
  554. X                  if (i == argc)
  555. X                    Error("missing color on -bordercolor",(char *) NULL);
  556. X                  border_color=argv[i];
  557. X                }
  558. X              break;
  559. X            }
  560. X          break;
  561. X        }
  562. X        case 'c':
  563. X        {
  564. X          if (strncmp("clip",option+1,2) == 0)
  565. X            {
  566. X              clip_geometry=(char *) NULL;
  567. X              if (*option == '-')
  568. X                {
  569. X                  i++;
  570. X                  if (i == argc)
  571. X                    Error("missing geometry on -clip",(char *) NULL);
  572. X                  clip_geometry=argv[i];
  573. X                }
  574. X              break;
  575. X            }
  576. X          if (strncmp("colors",option+1,7) == 0)
  577. X            {
  578. X              number_colors=0;
  579. X              if (*option == '-')
  580. X                {
  581. X                  i++;
  582. X                  if ((i == argc) || !sscanf(argv[i],"%d",&x))
  583. X                    Error("missing colors on -colors",(char *) NULL);
  584. X                  number_colors=atoi(argv[i]);
  585. X                }
  586. X              break;
  587. X            }
  588. X          if (strncmp("colorspace",option+1,7) == 0)
  589. X            {
  590. X              colorspace=RGBColorspace;
  591. X              if (*option == '-')
  592. X                {
  593. X                  i++;
  594. X                  if (i == argc)
  595. X                    Error("missing type on -colorspace",(char *) NULL);
  596. X                  option=argv[i];
  597. X                  colorspace=UndefinedColorspace;
  598. X                  if (Latin1Compare("gray",option) == 0)
  599. X                    colorspace=GRAYColorspace;
  600. X                  if (Latin1Compare("rgb",option) == 0)
  601. X                    colorspace=RGBColorspace;
  602. X                  if (Latin1Compare("xyz",option) == 0)
  603. X                    colorspace=XYZColorspace;
  604. X                  if (Latin1Compare("ycbcr",option) == 0)
  605. X                    colorspace=YCbCrColorspace;
  606. X                  if (Latin1Compare("yiq",option) == 0)
  607. X                    colorspace=YIQColorspace;
  608. X                  if (Latin1Compare("yuv",option) == 0)
  609. X                    colorspace=YUVColorspace;
  610. X                  if (colorspace == UndefinedColorspace)
  611. X                    Error("invalid colorspace type on -colorspace",option);
  612. X                }
  613. X              break;
  614. X            }
  615. X          if (strncmp("compress",option+1,3) == 0)
  616. X            {
  617. X              compression=NoCompression;
  618. X              if (*option == '-')
  619. X                {
  620. X                  i++;
  621. X                  if (i == argc)
  622. X                    Error("missing type on -compress",(char *) NULL);
  623. X                  option=argv[i];
  624. X                  if (Latin1Compare("runlengthencoded",option) == 0)
  625. X                    compression=RunlengthEncodedCompression;
  626. X                  else
  627. X                    if (Latin1Compare("qencoded",option) == 0)
  628. X                      compression=QEncodedCompression;
  629. X                    else
  630. X                      Error("invalid compression type on -compress",option);
  631. X                }
  632. X              break;
  633. X            }
  634. X          Error("unrecognized option",option);
  635. X          break;
  636. X        }
  637. X        case 'd':
  638. X        {
  639. X          if (strncmp("density",option+1,3) == 0)
  640. X            {
  641. X              density=(char *) NULL;
  642. X              if (*option == '-')
  643. X                {
  644. X                  i++;
  645. X                  if (i == argc)
  646. X                    Error("missing geometry on -density",(char *) NULL);
  647. X                  density=argv[i];
  648. X                }
  649. X              break;
  650. X            }
  651. X          if (strncmp("display",option+1,3) == 0)
  652. X            {
  653. X              server_name=(char *) NULL;
  654. X              if (*option == '-')
  655. X                {
  656. X                  i++;
  657. X                  if (i == argc)
  658. X                    Error("missing server name on -display",(char *) NULL);
  659. X                  server_name=argv[i];
  660. X                }
  661. X              break;
  662. X            }
  663. X          if (strncmp("dither",option+1,3) == 0)
  664. X            {
  665. X              dither=(*option == '-');
  666. X              break;
  667. X            }
  668. X          Error("unrecognized option",option);
  669. X          break;
  670. X        }
  671. X        case 'f':
  672. X        {
  673. X          font=(char *) NULL;
  674. X          if (*option == '-')
  675. X            {
  676. X              i++;
  677. X              if (i == argc)
  678. X                Error("missing font name on -font",(char *) NULL);
  679. X              font=argv[i];
  680. X            }
  681. X          break;
  682. X        }
  683. X        case 'g':
  684. X        {
  685. X          image_geometry=(char *) NULL;
  686. X          if (*option == '-')
  687. X            {
  688. X              i++;
  689. X              if (i == argc)
  690. X                Error("missing geometry on -geometry",(char *) NULL);
  691. X              image_geometry=argv[i];
  692. X            }
  693. X          break;
  694. X        }
  695. X        case 'h':
  696. X        {
  697. X          Usage();
  698. X          break;
  699. X        }
  700. X        case 'i':
  701. X        {
  702. X          if (strncmp("interlace",option+1,3) == 0)
  703. X            {
  704. X              interlace=NoneInterlace;
  705. X              if (*option == '-')
  706. X                {
  707. X                  i++;
  708. X                  if (i == argc)
  709. X                    Error("missing type on -interlace",(char *) NULL);
  710. X                  option=argv[i];
  711. X                  interlace=UndefinedInterlace;
  712. X                  if (Latin1Compare("none",option) == 0)
  713. X                    interlace=NoneInterlace;
  714. X                  if (Latin1Compare("line",option) == 0)
  715. X                    interlace=LineInterlace;
  716. X                  if (Latin1Compare("plane",option) == 0)
  717. X                    interlace=PlaneInterlace;
  718. X                  if (interlace == UndefinedInterlace)
  719. X                    Error("invalid interlace type on -interlace",option);
  720. X                }
  721. X              break;
  722. X            }
  723. X          Error("unrecognized option",option);
  724. X        }
  725. X        case 'm':
  726. X        {
  727. X          if (strncmp("monochrome",option+1,2) == 0)
  728. X            {
  729. X              monochrome=(*option == '-');
  730. X              break;
  731. X            }
  732. X          Error("unrecognized option",option);
  733. X        }
  734. X        case 'p':
  735. X        {
  736. X          if (strncmp("page",option+1,2) == 0)
  737. X            {
  738. X              page_geometry=(char *) NULL;
  739. X              if (*option == '-')
  740. X                {
  741. X                  i++;
  742. X                  if (i == argc)
  743. X                    Error("missing page geometry on -page",(char *) NULL);
  744. X                  page_geometry=argv[i];
  745. X                }
  746. X              break;
  747. X            }
  748. X          Error("unrecognized option",option);
  749. X          break;
  750. X        }
  751. X        case 'q':
  752. X        {
  753. X          i++;
  754. X          if ((i == argc) || !sscanf(argv[i],"%d",&x))
  755. X            Error("missing quality on -quality",(char *) NULL);
  756. X          quality=atoi(argv[i]);
  757. X          break;
  758. X        }
  759. X        case 's':
  760. X        {
  761. X          if (strncmp("scale",option+1,3) == 0)
  762. X            {
  763. X              scale_geometry=(char *) NULL;
  764. X              if (*option == '-')
  765. X                {
  766. X                  i++;
  767. X                  if ((i == argc) || !sscanf(argv[i],"%f",(float *) &x))
  768. X                    Error("missing scale geometry on -scale",(char *) NULL);
  769. X                  scale_geometry=argv[i];
  770. X                }
  771. X              break;
  772. X            }
  773. X          if (strncmp("scene",option+1,3) == 0)
  774. X            {
  775. X              scene=0;
  776. X              if (*option == '-')
  777. X                {
  778. X                  i++;
  779. X                  if ((i == argc) || !sscanf(argv[i],"%d",&x))
  780. X                    Error("missing scene number on -scene",(char *) NULL);
  781. X                  scene=atoi(argv[i]);
  782. X                }
  783. X              break;
  784. X            }
  785. X          Error("unrecognized option",option);
  786. X          break;
  787. X        }
  788. X        case 't':
  789. X        {
  790. X          tree_depth=0;
  791. X          if (*option == '-')
  792. X            {
  793. X              i++;
  794. X              if ((i == argc) || !sscanf(argv[i],"%d",&x))
  795. X                Error("missing depth on -treedepth",(char *) NULL);
  796. X              tree_depth=atoi(argv[i]);
  797. X            }
  798. X          break;
  799. X        }
  800. X        case 'v':
  801. X        {
  802. X          verbose=(*option == '-');
  803. X          break;
  804. X        }
  805. X        default:
  806. X        {
  807. X          Error("unrecognized option",option);
  808. X          break;
  809. X        }
  810. X      }
  811. X  }
  812. X  if (image == (Image *) NULL)
  813. X    Error("missing an image file name",(char *) NULL);
  814. X  /*
  815. X    Write images.
  816. X  */
  817. X  do
  818. X  {
  819. X    total_colors=0;
  820. X    if (alpha != NotInitialized)
  821. X      image->alpha=alpha;
  822. X    if (compression != UndefinedCompression)
  823. X      image->compression=compression;
  824. X    if (scene != 0)
  825. X      image->scene=scene;
  826. X    (void) strcpy(image->filename,argv[i]);
  827. X    if (image->previous != (Image *) NULL)
  828. X      (void) sprintf(image->filename,"%s.%u",argv[i],image->scene);
  829. X    /*
  830. X      Transform image as defined by the clip, image and scale geometries.
  831. X    */
  832. X    TransformImage(&image,clip_geometry,image_geometry,scale_geometry);
  833. X    if (monochrome)
  834. X      QuantizeImage(image,2,8,dither,GRAYColorspace,True);
  835. X    if (colorspace == GRAYColorspace)
  836. X      QuantizeImage(image,256,8,dither,GRAYColorspace,True);
  837. X    if (number_colors != 0)
  838. X      if ((image->class == DirectClass) || (image->colors > number_colors))
  839. X        {
  840. X          /*
  841. X            Reduce the number of colors in the image.
  842. X          */
  843. X          QuantizeImage(image,number_colors,tree_depth,dither,colorspace,True);
  844. X          if (verbose)
  845. X            {
  846. X              /*
  847. X                Measure quantization error.
  848. X              */
  849. X              QuantizationError(image,&mean_error_per_pixel,
  850. X                &normalized_mean_error,&normalized_maximum_error);
  851. X              total_colors=NumberColors(image,(FILE *) NULL);
  852. X            }
  853. X          SyncImage(image);
  854. X        }
  855. X    status=WriteImage(&image_info,image);
  856. X    if (verbose)
  857. X      {
  858. X        /*
  859. X          Display detailed info about the image.
  860. X        */
  861. X        (void) fprintf(stderr,"[%u] %s=>%s %ux%u",image->scene,filename,
  862. X          image->filename,image->columns,image->rows);
  863. X        if (image->class == DirectClass)
  864. X          (void) fprintf(stderr," DirectClass");
  865. X        else
  866. X          if (total_colors == 0)
  867. X            (void) fprintf(stderr," PseudoClass %uc",image->colors);
  868. X          else
  869. X            {
  870. X              (void) fprintf(stderr," PseudoClass %lu=>%uc",total_colors,
  871. X                image->colors);
  872. X              (void) fprintf(stderr," %u/%.6f/%.6fe",mean_error_per_pixel,
  873. X                normalized_mean_error,normalized_maximum_error);
  874. X            }
  875. X        (void) fprintf(stderr," %s %lds\n",image->magick,
  876. X          time((time_t *) NULL)-start_time+1);
  877. X      }
  878. X    next_image=image->next;
  879. X    DestroyImage(image);
  880. X    image=next_image;
  881. X  } while (image != (Image *) NULL);
  882. X  return(!status);
  883. }
  884. SHAR_EOF
  885. chmod 0644 ImageMagick/utilities/convert.c ||
  886. echo 'restore of ImageMagick/utilities/convert.c failed'
  887. Wc_c="`wc -c < 'ImageMagick/utilities/convert.c'`"
  888. test 26574 -eq "$Wc_c" ||
  889.     echo 'ImageMagick/utilities/convert.c: original size 26574, current size' "$Wc_c"
  890. rm -f _shar_wnt_.tmp
  891. fi
  892. # ============= ImageMagick/utilities/convert.man ==============
  893. if test -f 'ImageMagick/utilities/convert.man' -a X"$1" != X"-c"; then
  894.     echo 'x - skipping ImageMagick/utilities/convert.man (File already exists)'
  895.     rm -f _shar_wnt_.tmp
  896. else
  897. > _shar_wnt_.tmp
  898. echo 'x - extracting ImageMagick/utilities/convert.man (Text)'
  899. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/utilities/convert.man' &&
  900. .ad l
  901. .nh
  902. .TH convert 1 "10 October 1992" "ImageMagick"
  903. .SH NAME
  904. convert - converts an input file using one image format to an output
  905. file with a differing image format.
  906. .SH SYNOPSIS
  907. .B "convert"
  908. [ \fIoptions\fP ... ] \fIinput_file\fP \fIoutput_file\fP
  909. .SH DESCRIPTION
  910. \fBconvert\fP converts an input file using one image format to an output file
  911. with a differing image format.
  912. X
  913. \fBconvert\fP recognizes the following image formats:
  914. X
  915. .TP 6
  916. .B Tag
  917. \fBDescription\fP
  918. .PP
  919. -------------------------------------------------------------------------------
  920. .TP 6
  921. .B ALPHA
  922. Raw alpha bytes.
  923. .TP 6
  924. .B AVS
  925. AVS X image file.
  926. .TP 6
  927. .B BMP
  928. Microsoft Windows bitmap image file.
  929. .TP 6
  930. .B CMYK
  931. Raw cyan, magenta, yellow, and black bytes.
  932. .TP 6
  933. .B EPS
  934. Adobe Encapsulated PostScript file.
  935. .TP 6
  936. .B FAX
  937. Group 3.
  938. .TP 6
  939. .B GIF
  940. Compuserve Graphics image file.
  941. .TP 6
  942. .B GRAY
  943. Raw gray bytes.
  944. .TP 6
  945. .B HISTOGRAM
  946. .TP 6
  947. .B IRIS
  948. SGI RGB image file.
  949. .TP 6
  950. .B JPEG
  951. .TP 6
  952. .B MIFF
  953. Machine Independant file format.
  954. .TP 6
  955. .B MTV
  956. .TP 6
  957. .B PCX
  958. ZSoft IBM PC Paintbrush file.
  959. .TP 6
  960. .B PICT
  961. Apple Macintosh QuickDraw/PICT file.
  962. .TP 6
  963. .B PNM
  964. Portable bitmap.
  965. .TP 6
  966. .B PS
  967. Adobe PostScript file.
  968. .TP 6
  969. .B PS2
  970. Adobe Level II PostScript file.
  971. .TP 6
  972. .B RGB
  973. Raw red, green, and blue bytes.
  974. .TP 6
  975. .B RLE
  976. Utah Run length encoded image file; read only.
  977. .TP 6
  978. .B SUN
  979. SUN Rasterfile.
  980. .TP 6
  981. .B TEXT
  982. raw text file; read only.
  983. .TP 6
  984. .B TGA
  985. Truevision Targa image file.
  986. .TP 6
  987. .B TIFF
  988. Tagged Image File Format.
  989. .TP 6
  990. .B VICAR
  991. read only.
  992. .TP 6
  993. .B VIFF
  994. Khoros Visualization image file.
  995. .TP 6
  996. .B X
  997. select image from X server screen.
  998. .TP 6
  999. .B XC
  1000. constant image of X server border color.
  1001. .TP 6
  1002. .B XBM
  1003. XX11 bitmap file.
  1004. .TP 6
  1005. .B XWD
  1006. XX Window System window dump image file.
  1007. .TP 6
  1008. .B YUV
  1009. Raw Y, U, and V bytes.  U and V, normally -0.5 through 0.5, are normalized
  1010. to the range 0 through 255 to fit within a byte.
  1011. .PP
  1012. .SH EXAMPLES
  1013. .PP
  1014. To convert a \fIMIFF\fP image of a cockatoo to a SUN raster image, use:
  1015. .PP
  1016. .B
  1017. X     convert cockatoo.miff sun:cockatoo.ras
  1018. .PP
  1019. To convert a multi-page \fIPostscript\fP document to individual FAX pages, use:
  1020. .PP
  1021. .B
  1022. X     convert -monochrome document.ps fax:page
  1023. .PP
  1024. To convert a TIFF image to a \fIPostscript\fP A4 page with the image in
  1025. the lower left-hand corner, use:
  1026. .PP
  1027. .B
  1028. X     convert -page 595x842+0+0 image.tiff document.ps
  1029. .PP
  1030. To convert a raw \fBGRAY\fP image to a portable graymap, use:
  1031. .PP
  1032. .B
  1033. X     convert -geometry 768x512 gray:raw image.pnm
  1034. .SH OPTIONS
  1035. .TP 5
  1036. .B "-alpha"
  1037. store alpha channel if the image has one.
  1038. .TP 5
  1039. .B "-clip \fI<width>x<height>{\+-}<x offset>{\+-}<y offset>\fP"
  1040. preferred size and location of the clipped image.  See \fBX(1)\fP for details
  1041. about the geometry specification.
  1042. X
  1043. Use clipping to crop a particular area of an image.
  1044. .TP 5
  1045. .B "-colors \fIvalue\fP"
  1046. preferred number of colors in the image.
  1047. X
  1048. The actual number of colors in the image may be less than your request,
  1049. but never more.  Note, this is a color reduction option.  Images with
  1050. less unique colors than specified with this option will remain unchanged.
  1051. Refer to \fBquantize(9)\fP for more details.
  1052. X
  1053. Note, options \fB-dither\fP, \fB-colorspace\fP, and \fB-treedepth\fP affect
  1054. the color reduction algorithm.
  1055. .TP 5
  1056. .B "-colorspace \fIvalue\fP"
  1057. the type of colorspace: \fBGRAY\fP, \fBRGB\fP, \fBXYZ\fP, \fBYCbCr\fP,
  1058. \fBYIQ\fP, or \fBYUV\fP.
  1059. X
  1060. Color reduction, by default, takes place in the RGB color space.
  1061. Empirical evidence suggests that distances in color spaces such as YUV
  1062. or YIQ correspond to perceptual color differences more closely
  1063. than do distances in RGB space.  These color spaces may give better
  1064. results when color reducing an image.  Refer to \fBquantize(9)\fP for
  1065. more details.
  1066. X
  1067. The \fB-colors\fP or \fB-monochrome\fP option is required for this option
  1068. to take effect.
  1069. .TP 5
  1070. .B "-compress \fItype\fP"
  1071. the type of image compression: \fIQEncoded\fP or \fIRunlengthEncoded\fP.
  1072. X
  1073. Specify \fB\+compress\fP to store the binary image in an uncompressed format.
  1074. The default is the compression type of the specified image file.
  1075. .TP 5
  1076. .B "-density \fI<width>x<height>
  1077. vertical and horizonal density of the image.
  1078. X
  1079. This option specifies an image density whose interpretation changes
  1080. with the type of image.  The default is 72 dots per inch in the
  1081. horizonal and vertical direction for Postscript.  Text files default to
  1082. 80 characters in width and 60 lines in height.  Use this option to
  1083. alter the default density.
  1084. .TP 5
  1085. .B "-display \fIhost:display[.screen]\fP"
  1086. specifies the X server to contact; see \fBX(1)\fP.
  1087. .TP 5
  1088. .B "-dither"
  1089. apply Floyd/Steinberg error diffusion to the image.
  1090. X
  1091. The basic strategy of dithering is to trade intensity resolution for
  1092. spatial resolution by averaging the intensities of several neighboring
  1093. pixels.  Images which suffer from severe contouring when reducing colors
  1094. can be improved with this option.
  1095. X
  1096. The \fB-colors\fP option is required for dithering to take effect.
  1097. .TP 5
  1098. .B "-font \fIname\fP"
  1099. This option specifies the font to be used  for displaying normal text.
  1100. The default is \fBfixed\fP.
  1101. .TP 5
  1102. .B "-geometry \fI<width>x<height>\fP"
  1103. the width and height of the image.  
  1104. X
  1105. If the specified image size is smaller than the actual image size, the
  1106. image is first reduced to an integral of the specified image size with
  1107. an antialias digital filter.  The image is then scaled to the exact
  1108. specified image size with pixel replication.  If the specified image
  1109. size is greater than the actual image size, the image is first enlarged
  1110. to an integral of the specified image size with bilinear
  1111. interpolation.  The image is then scaled to the exact specified image
  1112. size with pixel replication.
  1113. X
  1114. Use this option to specify the width and height of raw images whose
  1115. dimensions are unknown such as \fBGRAY\fP, \fBRGB\fP, and \fBCMYK\fP.
  1116. This option can also change the default 8.5 by 11 width and height of
  1117. the Postscript canvas.
  1118. .TP 5
  1119. .B "-interlace \fItype\fP"
  1120. the type of interlacing scheme: \fBNONE\fP, \fBLINE\fP, or \fBPLANE\fP.
  1121. X
  1122. This option is used to specify the type of interlacing scheme for raw
  1123. image formats such as \fBRGB\fP or \fBYUV\fP.  \fBNONE\fP means do not
  1124. interlace (RGBRGBRGBRGBRGBRGB...), \fBLINE\fP uses scanline
  1125. interlacing (RRR...GGG...BBB...RRR...GGG...BBB...), and \fBPLANE\fP uses
  1126. plane interlacing (RRRRRR...GGGGGG...BBBBBB...).
  1127. .TP 5
  1128. .B "-monochrome"
  1129. transform the image to black and white.
  1130. X
  1131. Monochrome images can benefit from error diffusion.  Use \fB-dither\fP with
  1132. this option to diffuse the error.
  1133. .TP 5
  1134. .B "-page \fI<width>x<height>{\+-}<x offset>{\+-}<y offset>\fP"
  1135. preferred size and location of the Postscript page.
  1136. X
  1137. Use this option to specify the dimensions of the Postscript page in picas.  The
  1138. default is to center the image on a letter page, 612 by 792 picas.
  1139. Other common sizes are:
  1140. X
  1141. X    540x720   Note
  1142. X    612x1008  Legal
  1143. X    842x1190  A3
  1144. X    595x842   A4
  1145. X    421x595   A5
  1146. X    297x421   A6
  1147. X    709x1002  B4
  1148. X    612x936   U.S. Foolscap
  1149. X    612x936   European Foolscap
  1150. X    396x612   Half Letter
  1151. X    792x1224  11x17
  1152. X    1224x792  Ledger
  1153. X
  1154. The page geometry is relative to the vertical and horizonal density of the
  1155. Postscript page.  See \fB-density\fP for details.
  1156. .TP 5
  1157. .B "-quality \fIvalue\fP"
  1158. JPEG quality setting.
  1159. X
  1160. Quality is 0 (worst) to 100 (best). The default is 75.
  1161. .TP 5
  1162. .B "-scale \fI<width factor>x<height factor>\fP"
  1163. preferred size factors of the image.
  1164. X
  1165. This option behaves like \fB-geometry\fP except the width and height values
  1166. are relative instead of absolute.  The image size is multiplied by the
  1167. width and height factors to obtain the final image dimensions.  If only
  1168. one factor is specified, both the width and height factors assume the
  1169. value.
  1170. X
  1171. Factors may be fractional.  To increase the size of an image, use a
  1172. scale factor greater than 1.0.  To decrease an image's size, use a
  1173. scale factor less than 1.0.  Default is 1.0.
  1174. .TP 5
  1175. .B "-scene \fIvalue\fP"
  1176. image scene number.
  1177. .TP 5
  1178. .B "-treedepth \fIvalue\fP"
  1179. Normally, this integer value is zero or one.  A zero or one tells
  1180. \fBconvert\fP to choose a optimal tree depth for the color reduction
  1181. algorithm.
  1182. X
  1183. An optimal depth generally allows the best representation of the source
  1184. image with the fastest computational speed and the least amount of
  1185. memory.  However, the default depth is inappropriate for some images.
  1186. To assure the best representation, try values between 2 and 8 for this
  1187. parameter.  Refer to \fBquantize(9)\fP for more details.
  1188. X
  1189. The \fB-colors\fP option is required for this option to take effect.
  1190. .TP 5
  1191. .B -verbose
  1192. print detailed information about the image.
  1193. X
  1194. This information is printed: image scene number;  image name;  converted
  1195. image name;  image size;  the image class (\fIDirectClass\fP or 
  1196. \fIPseudoClass\fP);  the total number of unique colors;  and the number
  1197. of seconds to read and convert the image.
  1198. .PP
  1199. Change '-' to '+' in any option above to reverse its effect.  For
  1200. example, specify +alpha to store the image without its alpha channel.
  1201. .PP
  1202. By default, the image format is determined by its magic number. To
  1203. specify a particular image format, precede the filename with an image
  1204. format name and a colon (i.e. ps:image) or specify the image type as
  1205. the filename suffix (i.e. image.ps).  See \fBDESCRIPTION\fP for a list
  1206. of valid formats.
  1207. .PP
  1208. When you specify \fBX\fP as your image type, the filename has special
  1209. meaning.  It specifies an X window by id, name, or \fBroot\fP.  If no
  1210. filename is specified, the window is selected by clicking the mouse in
  1211. the desired window.
  1212. .PP
  1213. Specify \fIinput_file\fP as \fI-\fP for standard input,
  1214. \fIoutput_file\fP as \fI-\fP for standard output.  If \fIinput_file\fP
  1215. has the extension \fB.Z\fP or \fB.gz\fP, the file is uncompressed with
  1216. \fBuncompress\fP or \fBgunzip\fP respectively.  If \fIoutput_file\fP
  1217. has the extension \fB.Z\fP or \fB.gz\fP, the file size is compressed
  1218. using with \fBcompress\fP or \fBgzip\fP respectively.  If
  1219. \fIoutput_file\fP already exists, you will be prompted as to whether it
  1220. should be overwritten.
  1221. .SH ENVIRONMENT
  1222. .PP
  1223. .TP 5
  1224. .B display
  1225. To get the default host, display number, and screen.
  1226. .SH SEE ALSO
  1227. .B
  1228. display(1), animate(1), mogrify(1), quantize(9), X(1), miff(5)
  1229. .SH COPYRIGHT
  1230. Copyright 1993 E. I. du Pont de Nemours & Company
  1231. .PP
  1232. Permission to use, copy, modify, distribute, and sell this software and
  1233. its documentation for any purpose is hereby granted without fee,
  1234. provided that the above copyright notice appear in all copies and that
  1235. both that copyright notice and this permission notice appear in
  1236. supporting documentation, and that the name of E. I. du Pont de Nemours
  1237. & Company not be used in advertising or publicity pertaining to
  1238. distribution of the software without specific, written prior
  1239. permission.  E. I. du Pont de Nemours & Company makes no representations
  1240. about the suitability of this software for any purpose.  It is provided
  1241. "as is" without express or implied warranty.
  1242. .PP
  1243. E. I. du Pont de Nemours & Company disclaims all warranties with regard
  1244. to this software, including all implied warranties of merchantability
  1245. and fitness, in no event shall E. I. du Pont de Nemours & Company be
  1246. liable for any special, indirect or consequential damages or any
  1247. damages whatsoever resulting from loss of use, data or profits, whether
  1248. in an action of contract, negligence or other tortious action, arising
  1249. out of or in connection with the use or performance of this software.
  1250. .SH AUTHORS
  1251. John Cristy, E.I. du Pont De Nemours & Company Incorporated
  1252. SHAR_EOF
  1253. chmod 0644 ImageMagick/utilities/convert.man ||
  1254. echo 'restore of ImageMagick/utilities/convert.man failed'
  1255. Wc_c="`wc -c < 'ImageMagick/utilities/convert.man'`"
  1256. test 11344 -eq "$Wc_c" ||
  1257.     echo 'ImageMagick/utilities/convert.man: original size 11344, current size' "$Wc_c"
  1258. rm -f _shar_wnt_.tmp
  1259. fi
  1260. # ============= ImageMagick/utilities/mogrify.man ==============
  1261. if test -f 'ImageMagick/utilities/mogrify.man' -a X"$1" != X"-c"; then
  1262.     echo 'x - skipping ImageMagick/utilities/mogrify.man (File already exists)'
  1263.     rm -f _shar_wnt_.tmp
  1264. else
  1265. > _shar_wnt_.tmp
  1266. echo 'x - extracting ImageMagick/utilities/mogrify.man (Text)'
  1267. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/utilities/mogrify.man' &&
  1268. .ad l
  1269. .nh
  1270. .TH mogrify 1 "10 October 1992" "ImageMagick"
  1271. .SH NAME
  1272. mogrify - transform an image or sequence of images
  1273. .SH SYNOPSIS
  1274. .B "mogrify" [ \fIoptions\fP ...] \fIfile\fP
  1275. [ [ \fIoptions\fP ...] \fIfile\fP ...]
  1276. .SH DESCRIPTION
  1277. \fBmogrify\fP transforms an image or a sequence of images.  These
  1278. transforms include image scaling, image rotation, color reduction, and
  1279. others.  The transmogrified image overwrites the original image.
  1280. .SH EXAMPLES
  1281. To scale an image of a cockatoo to exactly 640 pixels in width and 480
  1282. pixels in height, use:
  1283. .PP
  1284. .B
  1285. X    mogrify -geometry 640x480 cockatoo.miff
  1286. .PP
  1287. To create a single colormap for a sequence of bird images, use:
  1288. .PP
  1289. .B
  1290. X    mogrify -colors 256 scenes/birds.*
  1291. .SH OPTIONS
  1292. .TP 5
  1293. .B "-border \fI<width>x<height>fP"
  1294. surround the image with a border or color.  See \fBX(1)\fP for details
  1295. about the geometry specification.
  1296. X
  1297. The color of the border is obtained from the X server and is defined as
  1298. \fBbackground\fP (class \fBBackground\fP).  See \fBX(1)\fP for details.
  1299. .TP 5
  1300. .B "-clip \fI<width>x<height>{\+-}<x offset>{\+-}<y offset>\fP"
  1301. preferred size and location of the clipped image.  See \fBX(1)\fP for details
  1302. about the geometry specification.
  1303. X
  1304. Use clipping to apply image processing options, or transmogrify, only a
  1305. particular area of an image.
  1306. .TP 5
  1307. .B "-colormap \fIfilename\fP"
  1308. choose a particular set of colors from this image.
  1309. X
  1310. By default, color reduction chooses an optimal set of colors that
  1311. best represent the original image.  Alternatively, you can choose a
  1312. particular set of colors with this option.  This is useful when
  1313. you want to create a sequence of images with one particular set of
  1314. colors for each image.
  1315. X
  1316. The \fB-colors\fP or \fB-monochrome\fP option is required
  1317. for this option to take effect.
  1318. .TP 5
  1319. .B "-colors \fIvalue\fP"
  1320. preferred number of colors in the image.
  1321. X
  1322. The actual number of colors in the image may be less than your request,
  1323. but never more.  Note, this is a color reduction option.  Images with
  1324. less unique colors than specified with this option will remain unchanged.
  1325. Refer to \fBquantize(9)\fP for more details.
  1326. X
  1327. If more than one image is specified on the command line, a single
  1328. colormap is created and saved with each image.
  1329. X
  1330. Note, options \fB-colormap\fP, \fB-dither\fP, \fB-colorspace\fP, and
  1331. \fB-treedepth\fP affect the color reduction algorithm.
  1332. .TP 5
  1333. .B "-colorspace \fIvalue\fP"
  1334. the type of colorspace: \fBGRAY\fP, \fBRGB\fP, \fBXYZ\fP, \fBYCbCr\fP,
  1335. \fBYIQ\fP, or \fBYUV\fP.
  1336. X
  1337. Color reduction, by default, takes place in the RGB color space.
  1338. Empirical evidence suggests that distances in color spaces such as YUV
  1339. or YIQ correspond to perceptual color differences more closely
  1340. than do distances in RGB space.  These color spaces may give better
  1341. results when color reducing an image.  Refer to \fBquantize(9)\fP for
  1342. more details.
  1343. X
  1344. The \fB-colors\fP or \fB-monochrome\fP option is required
  1345. for this option to take effect.
  1346. .TP 5
  1347. .B "-compress \fItype\fP"
  1348. the type of image compression: \fIQEncoded\fP or \fIRunlengthEncoded\fP.
  1349. X
  1350. Specify \fB\+compress\fP to store the binary image in an uncompressed format.
  1351. The default is the compression type of the specified image file.
  1352. .TP 5
  1353. .B "-density \fI<width>x<height>
  1354. vertical and horizonal density of the image.
  1355. X
  1356. This option specifies an image density whose interpretation changes
  1357. with the type of image.  The default is 72 dots per inch in the
  1358. horizonal and vertical direction for Postscript.  Text files default to
  1359. 80 characters in width and 60 lines in height.  Use this option to
  1360. alter the default density.
  1361. .TP 5
  1362. .B "-display \fIhost:display[.screen]\fP"
  1363. specifies the X server to contact; see \fBX(1)\fP.
  1364. .TP 5
  1365. .B "-dither"
  1366. apply Floyd/Steinberg error diffusion to the image.
  1367. X
  1368. The basic strategy of dithering is to trade intensity resolution for
  1369. spatial resolution by averaging the intensities of several neighboring
  1370. pixels.  Images which suffer from severe contouring when reducing colors
  1371. can be improved with this option.
  1372. X
  1373. The \fB-colors\fP or \fB-monochrome\fP option is required for this option
  1374. to take effect.
  1375. .TP 5
  1376. .B "-enhance"
  1377. apply a digital filter to enhance a noisy image.
  1378. .TP 5
  1379. .B "-gamma \fIvalue\fP"
  1380. level of gamma correction.
  1381. X
  1382. The same color image displayed on two different workstations may look
  1383. different due to differences in the display monitor.  Use gamma
  1384. correction to adjust for this color difference.  Reasonable values
  1385. extend from 0.8 to 2.3.
  1386. .TP 5
  1387. .B "-font \fIname\fP"
  1388. This option specifies the font to be used  for displaying normal text.
  1389. The default is \fBfixed\fP.
  1390. .TP 5
  1391. .B "-geometry \fI<width>x<height>\fP"
  1392. preferred size of the image window.  See \fBX(1)\fP for details
  1393. about the geometry specification.
  1394. X
  1395. If the specified image size is smaller than the actual image size, the
  1396. image is first reduced to an integral of the specified image size with
  1397. an antialias digital filter.  The image is then scaled to the exact
  1398. specified image size with pixel replication.  If the specified image
  1399. size is greater than the actual image size, the image is first enlarged
  1400. to an integral of the specified image size with bilinear
  1401. interpolation.  The image is then scaled to the exact specified image
  1402. size with pixel replication.
  1403. .TP 5
  1404. .B "-interlace \fItype\fP"
  1405. the type of interlacing scheme: \fBNONE\fP, \fBLINE\fP, or \fBPLANE\fP.
  1406. X
  1407. This option is used to specify the type of interlacing scheme for raw
  1408. image formats such as \fBRGB\fP or \fBYUV\fP.  \fBNONE\fP means do not
  1409. interlace (RGBRGBRGBRGBRGBRGB...), \fBLINE\fP uses scanline
  1410. interlacing (RRR...GGG...BBB...RRR...GGG...BBB...), and \fBPLANE\fP uses
  1411. plane interlacing (RRRRRR...GGGGGG...BBBBBB...).
  1412. .TP 5
  1413. .B "-inverse"
  1414. apply color inversion to image.
  1415. X
  1416. The red, green, and blue intensities of an image are negated.
  1417. .TP 5
  1418. .B "-monochrome"
  1419. transform the image to black and white.
  1420. X
  1421. Monochrome images can benefit from error diffusion.  Use \fB-dither\fP with
  1422. this option to diffuse the error.
  1423. .TP 5
  1424. .B "-noise"
  1425. reduce the noise in an image with a noise peak elimination filter.
  1426. X
  1427. The principal function of noise peak elimination filter is to smooth
  1428. the objects within an image without losing edge information and without
  1429. creating undesired structures.  The central idea of the algorithm is to
  1430. replace a pixel with its next neighbor in value within a 3 x 3 window,
  1431. if this pixel has been found to be noise.  A pixel is defined as noise
  1432. if and only if this pixel is a maximum or minimum within the 3 x 3 window.
  1433. .TP 5
  1434. .B "-normalize"
  1435. tranform image to span the full range of color values.
  1436. X
  1437. This is a contrast enhancement technique.
  1438. .TP 5
  1439. .B "-page \fI<width>x<height>{\+-}<x offset>{\+-}<y offset>\fP"
  1440. preferred size and location of the Postscript page.
  1441. X
  1442. Use this option to specify the dimensions of the Postscript page in picas.  The
  1443. default is to center the image on a letter page, 612 by 792 picas.
  1444. Other common sizes are:
  1445. X
  1446. X    540x720   Note
  1447. X    612x1008  Legal
  1448. X    842x1190  A3
  1449. X    595x842   A4
  1450. X    421x595   A5
  1451. X    297x421   A6
  1452. X    709x1002  B4
  1453. X    612x936   U.S. Foolscap
  1454. X    612x936   European Foolscap
  1455. X    396x612   Half Letter
  1456. X    792x1224  11x17
  1457. X    1224x792  Ledger
  1458. X
  1459. The page geometry is relative to the vertical and horizonal density of the
  1460. Postscript page.  See \fB-density\fP for details.
  1461. .TP 5
  1462. .B "-quality \fIvalue\fP"
  1463. JPEG quality setting.
  1464. X
  1465. Quality is 0 (worst) to 100 (best). The default is 75.
  1466. .TP 5
  1467. .B "-reflect"
  1468. create a "mirror image" by reflecting the image scanlines.
  1469. .TP 5
  1470. .B "-roll \fI{\+-}<x offset>{\+-}<y offset>\fP"
  1471. roll an image vertically or horizontally.  See \fBX(1)\fP for details
  1472. about the geometry specification.
  1473. A negative \fIx offset\fP rolls the image left-to-right.  A negative
  1474. \fIy offset\fP rolls the image top-to-bottom.
  1475. SHAR_EOF
  1476. true || echo 'restore of ImageMagick/utilities/mogrify.man failed'
  1477. fi
  1478. echo 'End of ImageMagick part 2'
  1479. echo 'File ImageMagick/utilities/mogrify.man is continued in part 3'
  1480. echo 3 > _shar_seq_.tmp
  1481. exit 0
  1482.  
  1483. exit 0 # Just in case...
  1484. -- 
  1485.   // chris@Sterling.COM           | Send comp.sources.x submissions to:
  1486. \X/  Amiga - The only way to fly! |    sources-x@sterling.com
  1487.  "It's intuitively obvious to the |
  1488.   most casual observer..."        | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
  1489.