home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sources / misc / 4193 < prev    next >
Encoding:
Text File  |  1992-12-14  |  57.3 KB  |  1,673 lines

  1. Newsgroups: comp.sources.misc
  2. Path: sparky!kent
  3. From: cristy@eplrx7.es.duPont.com (John Cristy)
  4. Subject:  v34i053:  imagemagick - X11 image processing and display v2.2, Part25/26
  5. Message-ID: <1992Dec15.035938.23162@sparky.imd.sterling.com>
  6. Followup-To: comp.sources.d
  7. X-Md4-Signature: 64aae8f7bdf9f3af4a6a9f14abf84424
  8. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  9. Organization: Sterling Software
  10. References: <csm-v34i028=imagemagick.141926@sparky.IMD.Sterling.COM>
  11. Date: Tue, 15 Dec 1992 03:59:38 GMT
  12. Approved: kent@sparky.imd.sterling.com
  13. Lines: 1658
  14.  
  15. Submitted-by: cristy@eplrx7.es.duPont.com (John Cristy)
  16. Posting-number: Volume 34, Issue 53
  17. Archive-name: imagemagick/part25
  18. Environment: UNIX, VMS, X11, SGI, DEC, Cray, Sun, Vax
  19.  
  20. #!/bin/sh
  21. # this is Part.25 (part 25 of a multipart archive)
  22. # do not concatenate these parts, unpack them in order with /bin/sh
  23. # file ImageMagick/utilities/mogrify.c continued
  24. #
  25. if test ! -r _shar_seq_.tmp; then
  26.     echo 'Please unpack part 1 first!'
  27.     exit 1
  28. fi
  29. (read Scheck
  30.  if test "$Scheck" != 25; then
  31.     echo Please unpack part "$Scheck" next!
  32.     exit 1
  33.  else
  34.     exit 0
  35.  fi
  36. ) < _shar_seq_.tmp || exit 1
  37. if test ! -f _shar_wnt_.tmp; then
  38.     echo 'x - still skipping ImageMagick/utilities/mogrify.c'
  39. else
  40. echo 'x - continuing file ImageMagick/utilities/mogrify.c'
  41. sed 's/^X//' << 'SHAR_EOF' >> 'ImageMagick/utilities/mogrify.c' &&
  42. X                  if (Latin1Compare("yiq",option) == 0)
  43. X                    colorspace=YIQColorspace;
  44. X                  if (Latin1Compare("yuv",option) == 0)
  45. X                    colorspace=YUVColorspace;
  46. X                  if (Latin1Compare("xyz",option) == 0)
  47. X                    colorspace=XYZColorspace;
  48. X                  if (colorspace == UndefinedColorspace)
  49. X                    Error("invalid colorspace type on -colorspace",option);
  50. X                }
  51. X              break;
  52. X            }
  53. X          if (strncmp("compress",option+1,3) == 0)
  54. X            {
  55. X              compression=NoCompression;
  56. X              if (*option == '-')
  57. X                {
  58. X                  i++;
  59. X                  if (i == argc)
  60. X                    Error("missing type on -compress",(char *) NULL);
  61. X                  option=argv[i];
  62. X                  if (Latin1Compare("runlengthencoded",option) == 0)
  63. X                    compression=RunlengthEncodedCompression;
  64. X                  else
  65. X                    if (Latin1Compare("qencoded",option) == 0)
  66. X                      compression=QEncodedCompression;
  67. X                    else
  68. X                      Error("invalid compression type on -compress",option);
  69. X                }
  70. X              break;
  71. X            }
  72. X          Error("unrecognized option",option);
  73. X          break;
  74. X        }
  75. X        case 'd':
  76. X        {
  77. X          if (strncmp("density",option+1,3) == 0)
  78. X            {
  79. X              alien_info.density=(char *) NULL;
  80. X              if (*option == '-')
  81. X                {
  82. X                  i++;
  83. X                  if (i == argc)
  84. X                    Error("missing density on -density",(char *) NULL);
  85. X                  alien_info.density=argv[i];
  86. X                }
  87. X              break;
  88. X            }
  89. X          if (strncmp("display",option+1,3) == 0)
  90. X            {
  91. X              alien_info.server_name=(char *) NULL;
  92. X              if (*option == '-')
  93. X                {
  94. X                  i++;
  95. X                  if (i == argc)
  96. X                    Error("missing server name on -display",(char *) NULL);
  97. X                  alien_info.server_name=argv[i];
  98. X                }
  99. X              break;
  100. X            }
  101. X          if (strncmp("dither",option+1,3) == 0)
  102. X            {
  103. X              dither=(*option == '-');
  104. X              break;
  105. X            }
  106. X          Error("unrecognized option",option);
  107. X          break;
  108. X        }
  109. X        case 'e':
  110. X        {
  111. X          enhance=(*option == '-');
  112. X          break;
  113. X        }
  114. X        case 'g':
  115. X        {
  116. X          if (strncmp("gamma",option+1,2) == 0)
  117. X            {
  118. X              gamma=0.0;
  119. X              if (*option == '-')
  120. X                {
  121. X                  i++;
  122. X                  if ((i == argc) || !sscanf(argv[i],"%f",(float *) &x))
  123. X                    Error("missing gamma on -gamma",(char *) NULL);
  124. X                  gamma=atof(argv[i]);
  125. X                }
  126. X              break;
  127. X            }
  128. X          if (strncmp("geometry",option+1,2) == 0)
  129. X            {
  130. X              image_geometry=(char *) NULL;
  131. X              if (*option == '-')
  132. X                {
  133. X                  i++;
  134. X                  if (i == argc)
  135. X                    Error("missing geometry on -geometry",(char *) NULL);
  136. X                  image_geometry=argv[i];
  137. X                }
  138. X              alien_info.geometry=image_geometry;
  139. X              break;
  140. X            }
  141. X          Error("unrecognized option",option);
  142. X          break;
  143. X        }
  144. X        case 'h':
  145. X        {
  146. X          Usage();
  147. X          break;
  148. X        }
  149. X        case 'i':
  150. X        {
  151. X          inverse=(*option == '-');
  152. X          break;
  153. X        }
  154. X        case 'm':
  155. X        {
  156. X          monochrome=(*option == '-');
  157. X          break;
  158. X        }
  159. X        case 'n':
  160. X        {
  161. X          if (strncmp("noise",option+1,3) == 0)
  162. X            {
  163. X              noise=(*option == '-');
  164. X              break;
  165. X            }
  166. X          if (strncmp("normalize",option+1,3) == 0)
  167. X            {
  168. X              normalize=(*option == '-');
  169. X              break;
  170. X            }
  171. X          Error("unrecognized option",option);
  172. X          break;
  173. X        }
  174. X        case 'r':
  175. X        {
  176. X          if (strncmp("reflect",option+1,2) == 0)
  177. X            {
  178. X              reflect=(*option == '-');
  179. X              break;
  180. X            }
  181. X          if (strncmp("rotate",option+1,3) == 0)
  182. X            {
  183. X              degrees=0;
  184. X              if (*option == '-')
  185. X                {
  186. X                  i++;
  187. X                  if ((i == argc) || !sscanf(argv[i],"%d",&x))
  188. X                    Error("missing degrees on -rotate",(char *) NULL);
  189. X                  degrees=atoi(argv[i]);
  190. X                }
  191. X              break;
  192. X            }
  193. X          Error("unrecognized option",option);
  194. X          break;
  195. X        }
  196. X        case 's':
  197. X        {
  198. X          if (strncmp("scale",option+1,3) == 0)
  199. X            {
  200. X              scale_geometry=(char *) NULL;
  201. X              if (*option == '-')
  202. X                {
  203. X                  i++;
  204. X                  if ((i == argc) || !sscanf(argv[i],"%f",(float *) &x))
  205. X                    Error("missing scale geometry on -scale",(char *) NULL);
  206. X                  scale_geometry=argv[i];
  207. X                }
  208. X              break;
  209. X            }
  210. X          if (strncmp("scene",option+1,3) == 0)
  211. X            {
  212. X              scene=0;
  213. X              if (*option == '-')
  214. X                {
  215. X                  i++;
  216. X                  if ((i == argc) || !sscanf(argv[i],"%d",&x))
  217. X                    Error("missing scene number on -scene",(char *) NULL);
  218. X                  scene=atoi(argv[i]);
  219. X                }
  220. X              break;
  221. X            }
  222. X          Error("unrecognized option",option);
  223. X          break;
  224. X        }
  225. X        case 't':
  226. X        {
  227. X          tree_depth=0;
  228. X          if (*option == '-')
  229. X            {
  230. X              i++;
  231. X              if ((i == argc) || !sscanf(argv[i],"%d",&x))
  232. X                Error("missing depth on -treedepth",(char *) NULL);
  233. X              tree_depth=atoi(argv[i]);
  234. X            }
  235. X          break;
  236. X        }
  237. X        case 'v':
  238. X        {
  239. X          verbose=(*option == '-');
  240. X          alien_info.verbose=verbose;
  241. X          break;
  242. X        }
  243. X        default:
  244. X        {
  245. X          Error("unrecognized option",option);
  246. X          break;
  247. X        }
  248. X      }
  249. X    else
  250. X      {
  251. X        Image
  252. X          *image,
  253. X          info_image,
  254. X          *next_image;
  255. X
  256. X        time_t
  257. X          start_time;
  258. X
  259. X        unsigned long
  260. X          total_colors;
  261. X
  262. X        /*
  263. X          Option is a file name: begin by reading image from specified file.
  264. X        */
  265. X        start_time=time((time_t *) 0);
  266. X        (void) strcpy(alien_info.filename,option);
  267. X        image=ReadAlienImage(&alien_info);
  268. X        if (image == (Image *) NULL)
  269. X          if (*option == '-')
  270. X            break;
  271. X          else
  272. X            continue;
  273. X        do
  274. X        {
  275. X          info_image=(*image);
  276. X          if (scene > 0)
  277. X            image->scene=scene;
  278. X          /*
  279. X            Transform image as defined by the clip, image and scale geometries.
  280. X          */
  281. X          TransformImage(&image,clip_geometry,image_geometry,scale_geometry);
  282. X          if (reflect)
  283. X            {
  284. X              Image
  285. X                *reflected_image;
  286. X
  287. X              /*
  288. X                Reverse image scanlines.
  289. X              */
  290. X              reflected_image=ReflectImage(image);
  291. X              if (reflected_image != (Image *) NULL)
  292. X                {
  293. X                  DestroyImage(image);
  294. X                  image=reflected_image;
  295. X                }
  296. X            }
  297. X          if ((degrees % 360) != 0)
  298. X            {
  299. X              Image
  300. X                *rotated_image;
  301. X
  302. X              /*
  303. X                Rotate image.
  304. X              */
  305. X              rotated_image=RotateImage(image,(double) degrees,False);
  306. X              if (rotated_image != (Image *) NULL)
  307. X                {
  308. X                  DestroyImage(image);
  309. X                  image=rotated_image;
  310. X                }
  311. X            }
  312. X          if (enhance)
  313. X            {
  314. X              Image
  315. X                *enhanced_image;
  316. X
  317. X              /*
  318. X                Enhance image.
  319. X              */
  320. X              enhanced_image=EnhanceImage(image);
  321. X              if (enhanced_image != (Image *) NULL)
  322. X                {
  323. X                  DestroyImage(image);
  324. X                  image=enhanced_image;
  325. X                }
  326. X            }
  327. X          if (noise)
  328. X            {
  329. X              Image
  330. X                *noisy_image;
  331. X
  332. X              /*
  333. X                Reduce noise in image.
  334. X              */
  335. X              noisy_image=NoisyImage(image);
  336. X              if (noisy_image != (Image *) NULL)
  337. X                {
  338. X                  DestroyImage(image);
  339. X                  image=noisy_image;
  340. X                }
  341. X            }
  342. X          if (gamma > 0.0)
  343. X            GammaImage(image,gamma);
  344. X          if (inverse)
  345. X            InverseImage(image);
  346. X          if (normalize)
  347. X            NormalizeImage(image);
  348. X          if (verbose)
  349. X            {
  350. X              /*
  351. X                Initialize image error attributes.
  352. X              */
  353. X              if (image->class == DirectClass)
  354. X                image->colors=NumberColors(image);
  355. X              total_colors=image->colors;
  356. X            }
  357. X          if (colorspace == GRAYColorspace)
  358. X            QuantizeImage(image,256,8,dither,GRAYColorspace,True);
  359. X          if (monochrome)
  360. X            QuantizeImage(image,2,8,dither,GRAYColorspace,True);
  361. X          if (number_colors > 0)
  362. X            if ((image->class == DirectClass) ||
  363. X                (image->colors > number_colors))
  364. X              QuantizeImage(image,number_colors,tree_depth,dither,colorspace,
  365. X                True);
  366. X          if (verbose)
  367. X            {
  368. X              /*
  369. X                Display detailed info about the image.
  370. X              */
  371. X              (void) fprintf(stderr,"[%u] %s",
  372. X                image->scene == 0 ? image_number : image->scene,
  373. X                info_image.filename);
  374. X              (void) fprintf(stderr," %ux%u",info_image.columns,
  375. X                info_image.rows);
  376. X              if ((info_image.columns != image->columns) ||
  377. X                  (info_image.rows != image->rows))
  378. X                (void) fprintf(stderr,"=>%ux%u",image->columns,image->rows);
  379. X              if (image->class == DirectClass)
  380. X                (void) fprintf(stderr," DirectClass ");
  381. X              else
  382. X                (void) fprintf(stderr," PseudoClass ");
  383. X              if (total_colors != image->colors)
  384. X                (void) fprintf(stderr,"%lu=>",total_colors);
  385. X              (void) fprintf(stderr,"%uc",image->colors);
  386. X              if ((number_colors > 0) || monochrome)
  387. X                {
  388. X                  double
  389. X                    normalized_maximum_error,
  390. X                    normalized_mean_error;
  391. X
  392. X                  unsigned int
  393. X                    mean_error_per_pixel;
  394. X
  395. X                  /*
  396. X                    Measure quantization error.
  397. X                  */
  398. X                  QuantizationError(image,&mean_error_per_pixel,
  399. X                    &normalized_mean_error,&normalized_maximum_error);
  400. X                  (void) fprintf(stderr," %u/%.6f/%.6fe",mean_error_per_pixel,
  401. X                    normalized_mean_error,normalized_maximum_error);
  402. X                }
  403. X              (void) fprintf(stderr," %s %lds\n",image->magick,
  404. X                time((time_t *) 0)-start_time+1);
  405. X            }
  406. X          if (compression != UndefinedCompression)
  407. X            image->compression=compression;
  408. X          else
  409. X            image->compression=info_image.compression;
  410. X          if (number_colors == 0)
  411. X            (void) WriteAlienImage(image);
  412. X          if (image_number == maximum_images)
  413. X            {
  414. X              /*
  415. X                Increase size of images array.
  416. X              */
  417. X              maximum_images<<=1;
  418. X              images=(Image **)
  419. X                realloc((char *) images,maximum_images*sizeof(Image *));
  420. X              if (images == (Image **) NULL)
  421. X                Error("unable to mogrify images","memory allocation failed");
  422. X            }
  423. X          images[image_number++]=image;
  424. X          next_image=image->next;
  425. X          if (next_image != (Image *) NULL)
  426. X            image=next_image;
  427. X        } while (next_image != (Image *) NULL);
  428. X        if (number_colors == 0)
  429. X          DestroyImages(image);
  430. X      }
  431. X    }
  432. X  if (image_number == 0)
  433. X    Error("missing an image file name",(char *) NULL);
  434. X  if (number_colors > 0)
  435. X    {
  436. X      Image
  437. X        *colormap_image;
  438. X
  439. X      /*
  440. X        Global colormap option;  reduce colors then write image.
  441. X      */
  442. X      if (colormap_filename != (char *) NULL)
  443. X        {
  444. X          (void) strcpy(alien_info.filename,colormap_filename);
  445. X          colormap_image=ReadAlienImage(&alien_info);
  446. X          if (colormap_image == (Image *) NULL)
  447. X            Error("unable to mogrify images","cannot read image colormap");
  448. X        }
  449. X      maximum_images=image_number;
  450. X      QuantizeImages(images,maximum_images,colormap_image,number_colors,
  451. X        tree_depth,dither,colorspace,True);
  452. X      if (colormap_image != (Image *) NULL)
  453. X    DestroyImage(colormap_image);
  454. X      for (image_number=0; image_number < maximum_images; image_number++)
  455. X      {
  456. X        (void) WriteAlienImage(images[image_number]);
  457. X        DestroyImage(images[image_number]);
  458. X      }
  459. X    }
  460. X  (void) free((char *) images);
  461. X  return(False);
  462. }
  463. SHAR_EOF
  464. echo 'File ImageMagick/utilities/mogrify.c is complete' &&
  465. chmod 0644 ImageMagick/utilities/mogrify.c ||
  466. echo 'restore of ImageMagick/utilities/mogrify.c failed'
  467. Wc_c="`wc -c < 'ImageMagick/utilities/mogrify.c'`"
  468. test 27143 -eq "$Wc_c" ||
  469.     echo 'ImageMagick/utilities/mogrify.c: original size 27143, current size' "$Wc_c"
  470. rm -f _shar_wnt_.tmp
  471. fi
  472. # ============= ImageMagick/utilities/Imakefile ==============
  473. if test -f 'ImageMagick/utilities/Imakefile' -a X"$1" != X"-c"; then
  474.     echo 'x - skipping ImageMagick/utilities/Imakefile (File already exists)'
  475.     rm -f _shar_wnt_.tmp
  476. else
  477. > _shar_wnt_.tmp
  478. echo 'x - extracting ImageMagick/utilities/Imakefile (Text)'
  479. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/utilities/Imakefile' &&
  480. #
  481. #  Imakefile for ImageMagick image utilities.
  482. #
  483. #  Copyright 1992 E. I. du Pont de Nemours & Company
  484. #
  485. #  Permission to use, copy, modify, distribute, and sell this software and
  486. #  its documentation for any purpose is hereby granted without fee,
  487. #  provided that the above Copyright notice appear in all copies and that
  488. #  both that Copyright notice and this permission notice appear in
  489. #  supporting documentation, and that the name of E. I. du Pont de Nemours
  490. #  & Company not be used in advertising or publicity pertaining to
  491. #  distribution of the software without specific, written prior
  492. #  permission.  E. I. du Pont de Nemours & Company makes no representations
  493. #  about the suitability of this software for any purpose.  It is provided
  494. #  "as is" without express or implied warranty.
  495. #
  496. #  E. I. du Pont de Nemours & Company disclaims all warranties with regard
  497. #  to this software, including all implied warranties of merchantability
  498. #  and fitness, in no event shall E. I. du Pont de Nemours & Company be
  499. #  liable for any special, indirect or consequential damages or any
  500. #  damages whatsoever resulting from loss of use, data or profits, whether
  501. #  in an action of contract, negligence or other tortious action, arising
  502. #  out of or in connection with the use or performance of this software.
  503. #
  504. X
  505. #include "../Magick.tmpl"
  506. X
  507. EXTRA_INCLUDES= -I..
  508. X
  509. MagickObjects= ../X.o ../image.o ../rotate.o ../quantize.o ../colors.o \
  510. X  ../signature.o ../compress.o ../alien.o ../PreRvIcccm.o
  511. X
  512. CONVERTObjects= convert.o $(MagickObjects)
  513. MOGRIFYObjects= mogrify.o $(MagickObjects)
  514. MIFFtoSTEREOSources= MIFFtoSTEREO.c
  515. MIFFtoSTEREOObjects= MIFFtoSTEREO.o $(MagickObjects)
  516. X
  517. PROGRAMS= mogrify convert MIFFtoSTEREO
  518. X
  519. AllTarget($(PROGRAMS))
  520. X
  521. NormalProgramTarget(mogrify,$(MOGRIFYObjects), , , )
  522. InstallProgram(mogrify,$(LOCALDIR))
  523. InstallManPage(mogrify,$(MANDIR))
  524. NormalProgramTarget(convert,$(CONVERTObjects), , , )
  525. InstallProgram(convert,$(LOCALDIR))
  526. InstallManPage(convert,$(MANDIR))
  527. NormalProgramTarget(MIFFtoSTEREO,$(MIFFtoSTEREOObjects), , , )
  528. InstallProgram(MIFFtoSTEREO,$(LOCALDIR))
  529. DependTarget()
  530. SHAR_EOF
  531. chmod 0644 ImageMagick/utilities/Imakefile ||
  532. echo 'restore of ImageMagick/utilities/Imakefile failed'
  533. Wc_c="`wc -c < 'ImageMagick/utilities/Imakefile'`"
  534. test 2095 -eq "$Wc_c" ||
  535.     echo 'ImageMagick/utilities/Imakefile: original size 2095, current size' "$Wc_c"
  536. rm -f _shar_wnt_.tmp
  537. fi
  538. # ============= ImageMagick/utilities/Makefile ==============
  539. if test -f 'ImageMagick/utilities/Makefile' -a X"$1" != X"-c"; then
  540.     echo 'x - skipping ImageMagick/utilities/Makefile (File already exists)'
  541.     rm -f _shar_wnt_.tmp
  542. else
  543. > _shar_wnt_.tmp
  544. echo 'x - extracting ImageMagick/utilities/Makefile (Text)'
  545. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/utilities/Makefile' &&
  546. #
  547. #  Generic makefile for convert, mogrify, MIFFtoSTEREO, and import for
  548. #  computers that do not have xmkmf.
  549. #
  550. #  Copyright 1992 E. I. du Pont de Nemours & Company
  551. #
  552. #  Permission to use, copy, modify, distribute, and sell this software and
  553. #  its documentation for any purpose is hereby granted without fee,
  554. #  provided that the above Copyright notice appear in all copies and that
  555. #  both that Copyright notice and this permission notice appear in
  556. #  supporting documentation, and that the name of E. I. du Pont de Nemours
  557. #  & Company not be used in advertising or publicity pertaining to
  558. #  distribution of the software without specific, written prior
  559. #  permission.  E. I. du Pont de Nemours & Company makes no representations
  560. #  about the suitability of this software for any purpose.  It is provided
  561. #  "as is" without express or implied warranty.
  562. #
  563. #  E. I. du Pont de Nemours & Company disclaims all warranties with regard
  564. #  to this software, including all implied warranties of merchantability
  565. #  and fitness, in no event shall E. I. du Pont de Nemours & Company be
  566. #  liable for any special, indirect or consequential damages or any
  567. #  damages whatsoever resulting from loss of use, data or profits, whether
  568. #  in an action of contract, negligence or other tortious action, arising
  569. #  out of or in connection with the use or performance of this software.
  570. #
  571. X
  572. #
  573. # Uncomment the following lines if you have the JPEG or TIFF libraries.
  574. # See README for more details.
  575. #
  576. #JPEG= -DAlienJPEG
  577. #JPEG_LIBRARIES= -L../jpeg -ljpeg
  578. #JPEG_INCLUDES= -I../jpeg
  579. #TIFF= -DAlienTIFF
  580. #TIFF_LIBRARIES= -L../tiff/libtiff -ltiff
  581. #TIFF_INCLUDES= -I../tiff/libtiff
  582. X
  583. XXLIB= -L/usr/lib/X11R4 -lX11
  584. X
  585. CC= cc -O -I/usr/include/X11R4
  586. DESTDIR= /usr/local/bin
  587. INSTALL = install -c
  588. RM= /bin/rm -f
  589. X
  590. DEFINES= -I.. $(JPEG) $(JPEG_INCLUDES) $(TIFF) $(TIFF_INCLUDES)
  591. SYS_LIBRARIES= $(XLIB) $(JPEG_LIBRARIES) $(TIFF_LIBRARIES) -lm
  592. X
  593. MagickObjects= ../X.o ../image.o ../rotate.o ../quantize.o ../colors.o \
  594. X  ../signature.o ../compress.o ../alien.o ../PreRvIcccm.o
  595. X
  596. ConvertObjects= convert.o $(MagickObjects)
  597. MogrifyObjects= mogrify.o $(MagickObjects)
  598. ImportObjects= import.o $(MagickObjects)
  599. MIFFtoSTEREOObjects= MIFFtoSTEREO.o $(MagickObjects)
  600. X
  601. PROGRAMS= convert mogrify MIFFtoSTEREO
  602. X
  603. CFLAGS= $(DEFINES)
  604. X
  605. all: $(PROGRAMS)
  606. X
  607. convert: $(ConvertObjects)
  608. X    $(RM) $@
  609. X    $(CC) -o $@ $(ConvertObjects) $(SYS_LIBRARIES)
  610. X
  611. clean::
  612. X    $(RM) convert
  613. X
  614. install:: convert
  615. X    $(INSTALL) convert $(DESTDIR)
  616. X
  617. mogrify: $(MogrifyObjects)
  618. X    $(RM) $@
  619. X    $(CC) -o $@ $(MogrifyObjects) $(SYS_LIBRARIES)
  620. X
  621. clean::
  622. X    $(RM) mogrify
  623. X
  624. install:: mogrify
  625. X    $(INSTALL) mogrify $(DESTDIR)
  626. X
  627. MIFFtoSTEREO: $(MIFFtoSTEREOObjects)
  628. X    $(RM) $@
  629. X    $(CC) -o $@ $(MIFFtoSTEREOObjects) $(SYS_LIBRARIES)
  630. X
  631. clean::
  632. X    $(RM) MIFFtoSTEREO
  633. X
  634. install:: MIFFtoSTEREO
  635. X    $(INSTALL) MIFFtoSTEREO $(DESTDIR)
  636. X
  637. clean::
  638. X    $(RM) *.ln *.bak *.o core errs ,* *~ *.a .emacs_* make.log MakeOut
  639. SHAR_EOF
  640. chmod 0644 ImageMagick/utilities/Makefile ||
  641. echo 'restore of ImageMagick/utilities/Makefile failed'
  642. Wc_c="`wc -c < 'ImageMagick/utilities/Makefile'`"
  643. test 2880 -eq "$Wc_c" ||
  644.     echo 'ImageMagick/utilities/Makefile: original size 2880, current size' "$Wc_c"
  645. rm -f _shar_wnt_.tmp
  646. fi
  647. # ============= ImageMagick/utilities/convert.c ==============
  648. if test -f 'ImageMagick/utilities/convert.c' -a X"$1" != X"-c"; then
  649.     echo 'x - skipping ImageMagick/utilities/convert.c (File already exists)'
  650.     rm -f _shar_wnt_.tmp
  651. else
  652. > _shar_wnt_.tmp
  653. echo 'x - extracting ImageMagick/utilities/convert.c (Text)'
  654. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/utilities/convert.c' &&
  655. /*
  656. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  657. %                                                                             %
  658. %                                                                             %
  659. %                                                                             %
  660. %                CCCC   OOO   N   N  V   V  EEEEE  RRRR   TTTTT               %
  661. %               C      O   O  NN  N  V   V  E      R   R    T                 %
  662. %               C      O   O  N N N  V   V  EEE    RRRR     T                 %
  663. %               C      O   O  N  NN   V V   E      R R      T                 %
  664. %                CCCC   OOO   N   N    V    EEEEE  R  R     T                 %
  665. %                                                                             %
  666. %                                                                             %
  667. %                 Convert a image from one format to another.                 %
  668. %                                                                             %
  669. %                                                                             %
  670. %                                                                             %
  671. %                              Software Design                                %
  672. %                                John Cristy                                  %
  673. %                                April 1992                                   %
  674. %                                                                             %
  675. %                                                                             %
  676. %  Copyright 1992 E. I. Dupont de Nemours & Company                           %
  677. %                                                                             %
  678. %  Permission to use, copy, modify, distribute, and sell this software and    %
  679. %  its documentation for any purpose is hereby granted without fee,           %
  680. %  provided that the above Copyright notice appear in all copies and that     %
  681. %  both that Copyright notice and this permission notice appear in            %
  682. %  supporting documentation, and that the name of E. I. Dupont de Nemours     %
  683. %  & Company not be used in advertising or publicity pertaining to            %
  684. %  distribution of the software without specific, written prior               %
  685. %  permission.  E. I. Dupont de Nemours & Company makes no representations    %
  686. %  about the suitability of this software for any purpose.  It is provided    %
  687. %  "as is" without express or implied warranty.                               %
  688. %                                                                             %
  689. %  E. I. Dupont de Nemours & Company disclaims all warranties with regard     %
  690. %  to this software, including all implied warranties of merchantability      %
  691. %  and fitness, in no event shall E. I. Dupont de Nemours & Company be        %
  692. %  liable for any special, indirect or consequential damages or any           %
  693. %  damages whatsoever resulting from loss of use, data or profits, whether    %
  694. %  in an action of contract, negligence or other tortious action, arising     %
  695. %  out of or in connection with the use or performance of this software.      %
  696. %                                                                             %
  697. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  698. %
  699. %  The convert program syntax is:
  700. %
  701. %  Usage: convert [options ...] file
  702. %
  703. %  Where options include:
  704. %    -alpha              store alpha channel if the image has one
  705. %    -colors value       preferred number of colors in the image
  706. %    -colorspace type    GRAY, RGB, XYZ, YIQ, or YUV
  707. %    -compress type      RunlengthEncoded or QEncoded
  708. %    -density geometry   vertical and horizonal density of the image
  709. %    -display server     obtain image or font from this X server
  710. %    -dither             apply Floyd/Steinberg error diffusion to image
  711. %    -geometry geometry  width and height of the image
  712. %    -quality value      JPEG quality setting
  713. %    -scene value        image scene number
  714. %    -treedepth value    depth of the color classification tree
  715. %    -verbose            print detailed information about the image
  716. %
  717. %  Change '-' to '+' in any option above to reverse its effect.  For
  718. %  example,  specify +alpha to store the image without its alpha channel.
  719. %
  720. %  By default, the image format of `file' is determined by its magic
  721. %  number.  To specify a particular image format, precede the filename
  722. %  with an image format name and a colon (i.e. mtv:image) or specify the
  723. %  image type as the filename suffix (i.e. image.mtv).  Specify 'file' as
  724. %  '-' for standard input or output.
  725. %
  726. %
  727. */
  728. X
  729. #include "display.h"
  730. #include "image.h"
  731. #include "alien.h"
  732. #include "X.h"
  733. X
  734. /*
  735. X  Global declarations.
  736. */
  737. char
  738. X  *application_name;
  739. X
  740. /*
  741. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  742. %                                                                             %
  743. %                                                                             %
  744. %                                                                             %
  745. %   E r r o r                                                                 %
  746. %                                                                             %
  747. %                                                                             %
  748. %                                                                             %
  749. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  750. %
  751. %  Function Error displays an error message and then terminates the program.
  752. %
  753. %  The format of the Error routine is:
  754. %
  755. %      Error(message,qualifier)
  756. %
  757. %  A description of each parameter follows:
  758. %
  759. %    o message: Specifies the message to display before terminating the
  760. %      program.
  761. %
  762. %    o qualifier: Specifies any qualifier to the message.
  763. %
  764. %
  765. */
  766. void Error(message,qualifier)
  767. char
  768. X  *message,
  769. X  *qualifier;
  770. {
  771. X  (void) fprintf(stderr,"%s: %s",application_name,message);
  772. X  if (qualifier != (char *) NULL)
  773. X    (void) fprintf(stderr," (%s)",qualifier);
  774. X  (void) fprintf(stderr,".\n");
  775. X  exit(1);
  776. }
  777. X
  778. /*
  779. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  780. %                                                                             %
  781. %                                                                             %
  782. %                                                                             %
  783. %   U s a g e                                                                 %
  784. %                                                                             %
  785. %                                                                             %
  786. %                                                                             %
  787. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  788. %
  789. %  Procedure Usage displays the program usage;
  790. %
  791. %  The format of the Usage routine is:
  792. %
  793. %      Usage()
  794. %
  795. %
  796. */
  797. static void Usage()
  798. {
  799. X  char
  800. X    **p;
  801. X
  802. X  static char
  803. X    *options[]=
  804. X    {
  805. X      "-alpha              store alpha channel if the image has one",
  806. X      "-colors value       preferred number of colors in the image",
  807. X      "-colorspace type    GRAY, RGB, XYZ, YIQ, or YUV",
  808. X      "-compress type      RunlengthEncoded or QEncoded",
  809. X      "-density geometry   vertical and horizonal density of the image",
  810. X      "-display server     obtain image or font from this X server",
  811. X      "-dither             apply Floyd/Steinberg error diffusion to image",
  812. X      "-geometry geometry  width and height of the image",
  813. X      "-quality value      JPEG quality setting",
  814. X      "-scene value        image scene number",
  815. X      "-treedepth value    depth of the color classification tree",
  816. X      "-verbose            print detailed information about the image",
  817. X      (char *) NULL
  818. X    };
  819. X  (void) fprintf(stderr,"Usage: %s [options ...] input_file output_file\n",
  820. X    application_name);
  821. X  (void) fprintf(stderr,"\nWhere options include:\n");
  822. X  for (p=options; *p != (char *) NULL; p++)
  823. X    (void) fprintf(stderr,"  %s\n",*p);
  824. X  (void) fprintf(stderr,
  825. X    "\nChange '-' to '+' in any option above to reverse its effect.  For\n");
  826. X  (void) fprintf(stderr,
  827. X    "example,  specify +alpha to store the image without an alpha channel.\n");
  828. X  (void) fprintf(stderr,
  829. X    "\nBy default, the image format of `file' is determined by its magic\n");
  830. X  (void) fprintf(stderr,
  831. X    "number.  To specify a particular image format, precede the filename\n");
  832. X  (void) fprintf(stderr,
  833. X    "with an image format name and a colon (i.e. mtv:image) or specify the\n");
  834. X  (void) fprintf(stderr,
  835. X    "image type as the filename suffix (i.e. image.mtv).  Specify 'file' as\n");
  836. X  (void) fprintf(stderr,"'-' for standard input or output.\n");
  837. X  exit(1);
  838. }
  839. X
  840. /*
  841. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  842. %                                                                             %
  843. %                                                                             %
  844. %                                                                             %
  845. %  M a i n                                                                    %
  846. %                                                                             %
  847. %                                                                             %
  848. %                                                                             %
  849. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  850. %
  851. %
  852. */
  853. int main(argc,argv)
  854. int
  855. X  argc;
  856. X
  857. char
  858. X  *argv[];
  859. {
  860. #define NotInitialized  (~0)
  861. X
  862. X  AlienInfo
  863. X    alien_info;
  864. X
  865. X  char
  866. X    *filename,
  867. X    *option;
  868. X
  869. X  Image
  870. X    *image,
  871. X    *next_image;
  872. X
  873. X  int
  874. X    i,
  875. X    status,
  876. X    x;
  877. X
  878. X  time_t
  879. X    start_time;
  880. X
  881. X  unsigned int
  882. X    alpha,
  883. X    colorspace,
  884. X    compression,
  885. X    dither,
  886. X    number_colors,
  887. X    quality,
  888. X    scene,
  889. X    total_colors,
  890. X    tree_depth,
  891. X    verbose;
  892. X
  893. X  /*
  894. X    Initialize program variables.
  895. X  */
  896. X  application_name=argv[0];
  897. X  if (argc < 3)
  898. X    Usage();
  899. X  /*
  900. X    Read image and convert to MIFF format.
  901. X  */
  902. X  GetAlienInfo(&alien_info);
  903. X  alpha=NotInitialized;
  904. X  colorspace=RGBColorspace;
  905. X  compression=UndefinedCompression;
  906. X  dither=False;
  907. X  number_colors=0;
  908. X  quality=0;
  909. X  scene=0;
  910. X  tree_depth=0;
  911. X  verbose=False;
  912. X  /*
  913. X    Check command syntax.
  914. X  */
  915. X  filename=(char *) NULL;
  916. X  for (i=1; i < (argc-1); i++)
  917. X  {
  918. X    option=argv[i];
  919. X    if (((int) strlen(option) < 2) || ((*option != '-') && (*option != '+')))
  920. X      filename=argv[i];
  921. X    else
  922. X      switch(*(option+1))
  923. X      {
  924. X        case 'a':
  925. X        {
  926. X          alpha=(*option == '-');
  927. X          break;
  928. X        }
  929. X        case 'c':
  930. X        {
  931. X          if (strncmp("colors",option+1,7) == 0)
  932. X            {
  933. X              number_colors=0;
  934. X              if (*option == '-')
  935. X                {
  936. X                  i++;
  937. X                  if ((i == argc) || !sscanf(argv[i],"%d",&x))
  938. X                    Error("missing colors on -colors",(char *) NULL);
  939. X                  number_colors=atoi(argv[i]);
  940. X                }
  941. X              break;
  942. X            }
  943. X          if (strncmp("colorspace",option+1,7) == 0)
  944. X            {
  945. X              colorspace=RGBColorspace;
  946. X              if (*option == '-')
  947. X                {
  948. X                  i++;
  949. X                  if (i == argc)
  950. X                    Error("missing type on -colorspace",(char *) NULL);
  951. X                  option=argv[i];
  952. X                  colorspace=UndefinedColorspace;
  953. X                  if (Latin1Compare("gray",option) == 0)
  954. X                    colorspace=GRAYColorspace;
  955. X                  if (Latin1Compare("rgb",option) == 0)
  956. X                    colorspace=RGBColorspace;
  957. X                  if (Latin1Compare("yiq",option) == 0)
  958. X                    colorspace=YIQColorspace;
  959. X                  if (Latin1Compare("yuv",option) == 0)
  960. X                    colorspace=YUVColorspace;
  961. X                  if (Latin1Compare("xyz",option) == 0)
  962. X                    colorspace=XYZColorspace;
  963. X                  if (colorspace == UndefinedColorspace)
  964. X                    Error("invalid colorspace type on -colorspace",option);
  965. X                }
  966. X              break;
  967. X            }
  968. X          if (strncmp("compress",option+1,3) == 0)
  969. X            {
  970. X              compression=NoCompression;
  971. X              if (*option == '-')
  972. X                {
  973. X                  i++;
  974. X                  if (i == argc)
  975. X                    Error("missing type on -compress",(char *) NULL);
  976. X                  option=argv[i];
  977. X                  if (Latin1Compare("runlengthencoded",option) == 0)
  978. X                    compression=RunlengthEncodedCompression;
  979. X                  else
  980. X                    if (Latin1Compare("qencoded",option) == 0)
  981. X                      compression=QEncodedCompression;
  982. X                    else
  983. X                      Error("invalid compression type on -compress",option);
  984. X                }
  985. X              break;
  986. X            }
  987. X          Error("unrecognized option",option);
  988. X          break;
  989. X        }
  990. X        case 'd':
  991. X        {
  992. X          if (strncmp("density",option+1,3) == 0)
  993. X            {
  994. X              alien_info.density=(char *) NULL;
  995. X              if (*option == '-')
  996. X                {
  997. X                  i++;
  998. X                  if (i == argc)
  999. X                    Error("missing density on -density",(char *) NULL);
  1000. X                  alien_info.density=argv[i];
  1001. X                }
  1002. X              break;
  1003. X            }
  1004. X          if (strncmp("display",option+1,3) == 0)
  1005. X            {
  1006. X              alien_info.server_name=(char *) NULL;
  1007. X              if (*option == '-')
  1008. X                {
  1009. X                  i++;
  1010. X                  if (i == argc)
  1011. X                    Error("missing server name on -display",(char *) NULL);
  1012. X                  alien_info.server_name=argv[i];
  1013. X                }
  1014. X              break;
  1015. X            }
  1016. X          if (strncmp("dither",option+1,3) == 0)
  1017. X            {
  1018. X              dither=(*option == '-');
  1019. X              break;
  1020. X            }
  1021. X          Error("unrecognized option",option);
  1022. X          break;
  1023. X        }
  1024. X        case 'f':
  1025. X        {
  1026. X          alien_info.font=(char *) NULL;
  1027. X          if (*option == '-')
  1028. X            {
  1029. X              i++;
  1030. X              if (i == argc)
  1031. X                Error("missing font name on -font",(char *) NULL);
  1032. X              alien_info.font=argv[i];
  1033. X            }
  1034. X          break;
  1035. X        }
  1036. X        case 'g':
  1037. X        {
  1038. X          alien_info.geometry=(char *) NULL;
  1039. X          if (*option == '-')
  1040. X            {
  1041. X              i++;
  1042. X              if (i == argc)
  1043. X                Error("missing geometry on -geometry",(char *) NULL);
  1044. X              alien_info.geometry=argv[i];
  1045. X            }
  1046. X          break;
  1047. X        }
  1048. X        case 'h':
  1049. X        {
  1050. X          Usage();
  1051. X          break;
  1052. X        }
  1053. X        case 'q':
  1054. X        {
  1055. X          i++;
  1056. X          if ((i == argc) || !sscanf(argv[i],"%d",&x))
  1057. X            Error("missing quality on -quality",(char *) NULL);
  1058. X          quality=atoi(argv[i]);
  1059. X          break;
  1060. X        }
  1061. X        case 's':
  1062. X        {
  1063. X          scene=0;
  1064. X          if (*option == '-')
  1065. X            {
  1066. X              i++;
  1067. X              if ((i == argc) || !sscanf(argv[i],"%d",&x))
  1068. X                Error("missing scene number on -scene",(char *) NULL);
  1069. X              scene=atoi(argv[i]);
  1070. X            }
  1071. X          break;
  1072. X        }
  1073. X        case 't':
  1074. X        {
  1075. X          tree_depth=0;
  1076. X          if (*option == '-')
  1077. X            {
  1078. X              i++;
  1079. X              if ((i == argc) || !sscanf(argv[i],"%d",&x))
  1080. X                Error("missing depth on -treedepth",(char *) NULL);
  1081. X              tree_depth=atoi(argv[i]);
  1082. X            }
  1083. X          break;
  1084. X        }
  1085. X        case 'v':
  1086. X        {
  1087. X          verbose=(*option == '-');
  1088. X          alien_info.verbose=verbose;
  1089. X          break;
  1090. X        }
  1091. X        default:
  1092. X        {
  1093. X          Error("unrecognized option",option);
  1094. X          break;
  1095. X        }
  1096. X      }
  1097. X  }
  1098. X  if (filename == (char *) NULL)
  1099. X    Error("missing an image file name",(char *) NULL);
  1100. X  start_time=time((time_t *) 0);
  1101. X  (void) strcpy(alien_info.filename,filename);
  1102. X  image=ReadAlienImage(&alien_info);
  1103. X  if (image == (Image *) NULL)
  1104. X    exit(1);
  1105. X  /*
  1106. X    Write images.
  1107. X  */
  1108. X  do
  1109. X  {
  1110. X    if (alpha != NotInitialized)
  1111. X      image->alpha=alpha;
  1112. X    if (compression != UndefinedCompression)
  1113. X      image->compression=compression;
  1114. X    if (quality > 0)
  1115. X      image->quality=quality;
  1116. X    if (scene > 0)
  1117. X      image->scene=scene;
  1118. X    (void) strcpy(image->filename,argv[i]);
  1119. X    if (image->last != (Image *) NULL)
  1120. X      (void) sprintf(image->filename,"%s.%u\0",argv[i],image->scene);
  1121. X    if (verbose)
  1122. X      {
  1123. X        /*
  1124. X          Initialize image error attributes.
  1125. X        */
  1126. X        if (image->class == DirectClass)
  1127. X          image->colors=NumberColors(image);
  1128. X        total_colors=image->colors;
  1129. X      }
  1130. X    if (colorspace == GRAYColorspace)
  1131. X      QuantizeImage(image,256,8,dither,GRAYColorspace,True);
  1132. X    if (number_colors > 0)
  1133. X      if ((image->class == DirectClass) || (image->colors > number_colors))
  1134. X        QuantizeImage(image,number_colors,tree_depth,dither,colorspace,True);
  1135. X    status=WriteAlienImage(image);
  1136. X    if (verbose)
  1137. X      {
  1138. X        /*
  1139. X          Display detailed info about the image.
  1140. X        */
  1141. X        (void) fprintf(stderr,"[%u] %s=>%s %ux%u",image->scene,filename,
  1142. X          image->filename,image->columns,image->rows);
  1143. X        if (image->class == DirectClass)
  1144. X          (void) fprintf(stderr," DirectClass ");
  1145. X        else
  1146. X          (void) fprintf(stderr," PseudoClass ");
  1147. X        if (total_colors != image->colors)
  1148. X          (void) fprintf(stderr,"%u=>",total_colors);
  1149. X        (void) fprintf(stderr,"%uc",image->colors);
  1150. X        if (number_colors > 0)
  1151. X          {
  1152. X            double
  1153. X              normalized_maximum_error,
  1154. X              normalized_mean_error;
  1155. X
  1156. X            unsigned int
  1157. X              mean_error_per_pixel;
  1158. X
  1159. X            /*
  1160. X              Measure quantization error.
  1161. X            */
  1162. X            QuantizationError(image,&mean_error_per_pixel,
  1163. X              &normalized_mean_error,&normalized_maximum_error);
  1164. X            (void) fprintf(stderr," %u/%.6f/%.6fe",mean_error_per_pixel,
  1165. X              normalized_mean_error,normalized_maximum_error);
  1166. X          }
  1167. X        (void) fprintf(stderr," %s %lds\n",image->magick,
  1168. X          time((time_t *) 0)-start_time+1);
  1169. X      }
  1170. X    next_image=image->next;
  1171. X    DestroyImage(image);
  1172. X    image=next_image;
  1173. X  } while (image != (Image *) NULL);
  1174. X  return(!status);
  1175. }
  1176. SHAR_EOF
  1177. chmod 0644 ImageMagick/utilities/convert.c ||
  1178. echo 'restore of ImageMagick/utilities/convert.c failed'
  1179. Wc_c="`wc -c < 'ImageMagick/utilities/convert.c'`"
  1180. test 18313 -eq "$Wc_c" ||
  1181.     echo 'ImageMagick/utilities/convert.c: original size 18313, current size' "$Wc_c"
  1182. rm -f _shar_wnt_.tmp
  1183. fi
  1184. # ============= ImageMagick/utilities/mogrify.man ==============
  1185. if test -f 'ImageMagick/utilities/mogrify.man' -a X"$1" != X"-c"; then
  1186.     echo 'x - skipping ImageMagick/utilities/mogrify.man (File already exists)'
  1187.     rm -f _shar_wnt_.tmp
  1188. else
  1189. > _shar_wnt_.tmp
  1190. echo 'x - extracting ImageMagick/utilities/mogrify.man (Text)'
  1191. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/utilities/mogrify.man' &&
  1192. .ad l
  1193. .nh
  1194. .TH MOGRIFY 1 "10 October 1992" "ImageMagick"
  1195. .SH NAME
  1196. mogrify - transform an image or sequence of images
  1197. .SH SYNOPSIS
  1198. .B "mogrify" [ \fIoptions\fP ...] \fIfile\fP
  1199. [ [ \fIoptions\fP ...] \fIfile\fP ...]
  1200. .SH DESCRIPTION
  1201. \fIMogrify\fP transforms an image or a sequence of images.  These
  1202. transforms include image scaling, image rotation, color reduction, and
  1203. others.  The transmogrified image overwrites the original image.
  1204. .SH EXAMPLES
  1205. To scale an image of a cockatoo to exactly 640 pixels in width and 480
  1206. pixels in height, use:
  1207. .PP
  1208. X    mogrify -geometry 640x480 cockatoo.miff
  1209. .PP
  1210. To create a single colormap for a sequence of bird images, use:
  1211. .PP
  1212. X    mogrify -colors 256 scenes/birds.*
  1213. .SH OPTIONS
  1214. .TP 5
  1215. .B "-clip \fI<width>x<height>{\+-}<x offset>{\+-}<y offset>\fP"
  1216. preferred size and location of the clipped image.  See \fBX(1)\fP for details
  1217. about the geometry specification.
  1218. X
  1219. Use clipping to apply image processing options, or transmogrify, only a
  1220. particular area of an image.
  1221. .TP 5
  1222. .B "-colors \fIvalue\fP"
  1223. preferred number of colors in the image.
  1224. X
  1225. The actual number of colors in the image may be less than your request,
  1226. but never more.  Note, this is a color reduction option.  Images with
  1227. less unique colors than specified with this option will remain unchanged.
  1228. Refer to \fBQuantize(9)\fP for more details.
  1229. X
  1230. If more than one image is specified on the command line, a single
  1231. colormap is created and saved with each image.
  1232. X
  1233. Note, options \fB-dither\fP, \fB-colorspace\fP, and \fB-treedepth\fP affect
  1234. the color reduction algorithm.
  1235. .TP 5
  1236. .B "-colorspace \fIvalue\fP"
  1237. the type of colorspace: \fIGRAY\fP, \fIRGB\fP, \fIXYZ\fP, \fIYIQ\fP, or
  1238. \fIYUV\fP.
  1239. X
  1240. Color reduction, by default, takes place in the RGB color space.
  1241. Empirical evidence suggests that distances in color spaces such as YUV
  1242. or YIQ correspond to perceptual color differences more closely
  1243. than do distances in RGB space.  These color spaces may give better
  1244. results when color reducing an image.  Refer to \fBQuantize(9)\fP for
  1245. more details.
  1246. X
  1247. The \fB-colors\fP or \fB-monochrome\fP option is required
  1248. for this option to take effect.
  1249. .TP 5
  1250. .B "-compress \fItype\fP"
  1251. the type of image compression: \fIQEncoded\fP or \fIRunlengthEncoded\fP.
  1252. X
  1253. Specify \fB\+compress\fP to store the binary image in an uncompressed format.
  1254. The default is the compression type of the specified image file.
  1255. .TP 5
  1256. .B "-density \fI<width>x<height>
  1257. vertical and horizonal density of the image.
  1258. X
  1259. This option specifies an image density whose interpretation changes
  1260. with the type of image.  The default is 72 dots per inch in the
  1261. horizonal and vertical direction for Postscript.  Text files default to
  1262. 80 characters in width and 60 lines in height.  Use this option to
  1263. alter the default density.
  1264. .TP 5
  1265. .B "-display \fIhost:display[.screen]\fP"
  1266. specifies the X server to contact; see \fBX(1)\fP.
  1267. .TP 5
  1268. .B "-dither"
  1269. apply Floyd/Steinberg error diffusion to the image.
  1270. X
  1271. The basic strategy of dithering is to trade intensity resolution for
  1272. spatial resolution by averaging the intensities of several neighboring
  1273. pixels.  Images which suffer from severe contouring when reducing colors
  1274. can be improved with this option.
  1275. X
  1276. The \fB-colors\fP or \fB-monochrome\fP option is required for this option
  1277. to take effect.
  1278. .TP 5
  1279. .B "-enhance"
  1280. apply a digital filter to enhance a noisy image.
  1281. .TP 5
  1282. .B "-gamma \fIvalue\fP"
  1283. level of gamma correction.
  1284. X
  1285. The same color image displayed on two different workstations may look
  1286. different due to differences in the display monitor.  Use gamma
  1287. correction to adjust for this color difference.  Reasonable values
  1288. extend from 0.8 to 2.3.
  1289. .TP 5
  1290. .B "-geometry \fI<width>x<height>\fP"
  1291. preferred size of the image window.  See \fBX(1)\fP for details
  1292. about the geometry specification.
  1293. X
  1294. If the specified image size is smaller than the actual image size, the
  1295. image is first reduced to an integral of the specified image size with
  1296. an antialias digital filter.  The image is then scaled to the exact
  1297. specified image size with pixel replication.  If the specified image
  1298. size is greater than the actual image size, the image is first enlarged
  1299. to an integral of the specified image size with bilinear
  1300. interpolation.  The image is then scaled to the exact specified image
  1301. size with pixel replication.
  1302. .TP 5
  1303. .B "-inverse"
  1304. apply color inversion to image.
  1305. X
  1306. The red, green, and blue intensities of an image are negated.
  1307. .TP 5
  1308. .B "-monochrome"
  1309. transform the image to black and white.
  1310. X
  1311. Monochrome images can benefit from error diffusion.  Use \fB-dither\fP with
  1312. this option to diffuse the error.
  1313. .TP 5
  1314. .B "-noise"
  1315. reduce the noise in an image with a noise peak elimination filter.
  1316. X
  1317. The principal function of noise peak elimination filter is to smooth
  1318. the objects within an image without losing edge information and without
  1319. creating undesired structures.  The central idea of the algorithm is to
  1320. replace a pixel with its next neighbor in value within a 3 x 3 window,
  1321. if this pixel has been found to be noise.  A pixel is defined as noise
  1322. if and only if this pixel is a maximum or minimum within the 3 x 3 window.
  1323. .TP 5
  1324. .B "-normalize"
  1325. tranform image to span the full range of color values.  This is a contrast
  1326. enhancement technique.
  1327. .TP 5
  1328. .B "-reflect"
  1329. create a "mirror image" by reflecting the image scanlines.
  1330. .TP 5
  1331. .B "-rotate \fIdegrees\fP"
  1332. apply Paeth image rotation to the image.
  1333. .TP 5
  1334. .B "-scale \fI<width factor>x<height factor>\fP"
  1335. preferred size factors of the image.
  1336. X
  1337. This option behaves like \fB-geometry\fP except the width and height values
  1338. are relative instead of absolute.  The image size is multiplied by the
  1339. width and height factors to obtain the final image dimensions.  If only
  1340. one factor is specified, both the width and height factors assume the
  1341. value.
  1342. X
  1343. Factors may be fractional.  For example, a factor of 1.5 will increase the
  1344. image size by one and one-half.
  1345. .TP 5
  1346. .B "-scene \fIvalue\fP"
  1347. image scene number.
  1348. .TP 5
  1349. .B "-treedepth \fIvalue\fP"
  1350. Normally, this integer value is zero or one.  A zero or one tells
  1351. \fIMogrify\fP to choose a optimal tree depth for the color reduction
  1352. algorithm.
  1353. X
  1354. An optimal depth generally allows the best representation of the source
  1355. image with the fastest computational speed and the least amount of
  1356. memory.  However, the default depth is inappropriate for some images.
  1357. To assure the best representation, try values between 2 and 8 for this
  1358. parameter.  Refer to \fBQuantize(9)\fP for more details.
  1359. X
  1360. The \fB-colors\fP or \fB-monochrome\fP option is required for this option
  1361. to take effect.
  1362. .TP 5
  1363. .B -verbose
  1364. print detailed information about the image.
  1365. X
  1366. This information is printed: image scene number;  image name;  image
  1367. size; the image class (\fIDirectClass\fP or \fIPseudoClass\fP); the total
  1368. number of unique colors (if known);  and the number of seconds to read and
  1369. transform the image.  Refer to \fBMIFF(5)\fP for a description of
  1370. the image class.
  1371. X
  1372. If \fB-colors\fP is also specified, the total unique colors in the image
  1373. and color reduction error values are printed.  Refer to \fBQuantize(9)\fP
  1374. for a description of these values.
  1375. .PP
  1376. Any option you specify on the command line remains in effect until it is
  1377. explicitly changed by specifying the option again with a different effect.
  1378. For example, to mogrify two images, the first with 32 colors and the
  1379. second with only 16 colors, use:
  1380. .PP
  1381. X     mogrify -colors 32 cockatoo.miff -colors 16 macaw.miff
  1382. .PP
  1383. Change \fI-\fP to \fI\+\fP in any option above to reverse its effect.
  1384. For example, specify \fB\+compress\fP to store the binary image in an
  1385. uncompressed format.
  1386. .PP
  1387. To specify a particular image format prefix \fIfile\fP with the image
  1388. type and a colon (i.e. mtv:image) or specify the image type as the
  1389. filename suffix (i.e. image.mtv).  See \fBCONVERT(1)\fP for a list of
  1390. valid image formats.  If \fIfile\fP has the extension \fB.Z\fP, the
  1391. file size is reduced using Lempel-Ziv coding with \fBcompress\fP.  If
  1392. \fIfile\fP already exists, you will be prompted as to whether it should
  1393. be overwritten.
  1394. .SH SEE ALSO
  1395. display(1), animate(1), import(1), convert(1), Quantize(9), MIFF(5), X(1),
  1396. compress(1)
  1397. .SH COPYRIGHT
  1398. Copyright 1992 E. I. du Pont de Nemours & Company
  1399. .PP
  1400. Permission to use, copy, modify, distribute, and sell this software and
  1401. its documentation for any purpose is hereby granted without fee,
  1402. provided that the above copyright notice appear in all copies and that
  1403. both that copyright notice and this permission notice appear in
  1404. supporting documentation, and that the name of E. I. du Pont de Nemours
  1405. & Company not be used in advertising or publicity pertaining to
  1406. distribution of the software without specific, written prior
  1407. permission.  E. I. du Pont de Nemours & Company makes no representations
  1408. about the suitability of this software for any purpose.  It is provided
  1409. "as is" without express or implied warranty.
  1410. .PP
  1411. E. I. du Pont de Nemours & Company disclaims all warranties with regard
  1412. to this software, including all implied warranties of merchantability
  1413. and fitness, in no event shall E. I. du Pont de Nemours & Company be
  1414. liable for any special, indirect or consequential damages or any
  1415. damages whatsoever resulting from loss of use, data or profits, whether
  1416. in an action of contract, negligence or other tortious action, arising
  1417. out of or in connection with the use or performance of this software.
  1418. .SH ACKNOWLEDGEMENTS
  1419. Michael Halle, Spatial Imaging Group at MIT, for the initial
  1420. implementation of Alan Paeth's image rotation algorithm.
  1421. .PP
  1422. David Pensak, E. I. du Pont de Nemours & Company, for providing a
  1423. computing environment that made this program possible.
  1424. .PP
  1425. Paul Raveling, USC Information Sciences Institute, for the original
  1426. idea of using space subdivision for the color reduction algorithm.
  1427. .SH AUTHORS
  1428. John Cristy, E.I. du Pont de Nemours & Company Incorporated
  1429. SHAR_EOF
  1430. chmod 0644 ImageMagick/utilities/mogrify.man ||
  1431. echo 'restore of ImageMagick/utilities/mogrify.man failed'
  1432. Wc_c="`wc -c < 'ImageMagick/utilities/mogrify.man'`"
  1433. test 9749 -eq "$Wc_c" ||
  1434.     echo 'ImageMagick/utilities/mogrify.man: original size 9749, current size' "$Wc_c"
  1435. rm -f _shar_wnt_.tmp
  1436. fi
  1437. # ============= ImageMagick/utilities/convert.man ==============
  1438. if test -f 'ImageMagick/utilities/convert.man' -a X"$1" != X"-c"; then
  1439.     echo 'x - skipping ImageMagick/utilities/convert.man (File already exists)'
  1440.     rm -f _shar_wnt_.tmp
  1441. else
  1442. > _shar_wnt_.tmp
  1443. echo 'x - extracting ImageMagick/utilities/convert.man (Text)'
  1444. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/utilities/convert.man' &&
  1445. .ad l
  1446. .nh
  1447. .TH CONVERT 1 "10 October 1992" "ImageMagick"
  1448. .SH NAME
  1449. convert - converts an input file using one image format to an output
  1450. file with a differing image format.
  1451. .SH SYNOPSIS
  1452. .B "convert"
  1453. [ \fIoptions\fP ... ] \fIfile\fP \fIfile\fP
  1454. .SH DESCRIPTION
  1455. .PP
  1456. .I Convert
  1457. converts an input file using one image format to an output file with a
  1458. differing image format. By default, the image format is determined by
  1459. its magic number. To specify a particular image format, precede the 
  1460. filename with an image format name and a colon (i.e.  mtv:image) or specify 
  1461. the image type as the filename suffix (i.e. image.mtv).  Specify \fIfile\fP as 
  1462. \fI-\fP for standard input or output.  If \fIfile\fP has the extension 
  1463. \fB.Z\fP, the file is decoded with \fIuncompress\fP.
  1464. X
  1465. \fIConvert\fP recognizes the following image formats:
  1466. X
  1467. .TP 6
  1468. .B Tag
  1469. \fBDescription\fP
  1470. .PP
  1471. -------------------------------------------------------------
  1472. .TP 6
  1473. .B AVS
  1474. Advanced Visualization System image file format.
  1475. .TP 6
  1476. .B CMYK    
  1477. Raw cyan, magenta, yellow, and black bytes.
  1478. .TP 6
  1479. .B FAX
  1480. Group 3.
  1481. .TP 6
  1482. .B GIF
  1483. Graphic Image Format.
  1484. .TP 6
  1485. .B GRAY
  1486. Raw gray bytes.
  1487. .TP 6
  1488. .B JPEG
  1489. .TP 6
  1490. .B MIFF
  1491. Machine Independant file format.
  1492. .TP 6
  1493. .B MTV
  1494. .TP 6
  1495. .B PNM
  1496. Portable bitmap.
  1497. .TP 6
  1498. .B PS
  1499. Postscript.
  1500. .TP 6
  1501. .B RGB
  1502. Raw red, green, and blue bytes.
  1503. .TP 6
  1504. .B RLE
  1505. Utah Raster Toolkit; read only.
  1506. .TP 6
  1507. .B SUN
  1508. SUN raster.
  1509. .TP 6
  1510. .B TEXT
  1511. raw text file; read only.
  1512. .TP 6
  1513. .B TIFF
  1514. Tagged Image File Format.
  1515. .TP 6
  1516. .B VICAR
  1517. read only.
  1518. .TP 6
  1519. .B YUV
  1520. Raw Y, U, and V bytes.  U and V, normally -0.5 through 0.5, are normalized
  1521. to the range 0 through 255 to fit within a byte.
  1522. .TP 6
  1523. .B X
  1524. select image from X server screen; read only.
  1525. .TP 6
  1526. .B XC
  1527. constant image of X server background color.
  1528. .TP 6
  1529. .B XBM
  1530. XX11 bitmap.
  1531. .TP 6
  1532. .B XWD
  1533. XX11 window dump.
  1534. .PP
  1535. .SH EXAMPLES
  1536. .PP
  1537. To convert a \fIMIFF\fP image of a cockatoo to a SUN raster image, use:
  1538. .PP
  1539. X     convert cockatoo.miff sun:cockatoo.ras
  1540. .PP
  1541. To convert a \fIMTV\fP image of a molecule to a JPEG image, use:
  1542. .PP
  1543. X     convert molecule.mtv molecule.jpeg
  1544. .PP
  1545. To convert a raw \fIGRAY\fP image to a portable graymap, use:
  1546. .PP
  1547. X     convert -geometry 768x512 gray:raw image.pnm
  1548. .SH OPTIONS
  1549. .TP 5
  1550. .B "-alpha"
  1551. store alpha channel if the image has one.
  1552. .TP 5
  1553. .B "-colors \fIvalue\fP"
  1554. preferred number of colors in the image.
  1555. X
  1556. The actual number of colors in the image may be less than your request,
  1557. but never more.  Note, this is a color reduction option.  Images with
  1558. less unique colors than specified with this option will remain unchanged.
  1559. Refer to \fBQuantize(9)\fP for more details.
  1560. X
  1561. Note, options \fB-dither\fP, \fB-colorspace\fP, and \fB-treedepth\fP affect
  1562. the color reduction algorithm.
  1563. .TP 5
  1564. .B "-colorspace \fIvalue\fP"
  1565. the type of colorspace: \fIGRAY\fP, \fIRGB\fP, \fIXYZ\fP, \fIYIQ\fP, or
  1566. \fIYUV\fP.
  1567. X
  1568. Color reduction, by default, takes place in the RGB color space.
  1569. Empirical evidence suggests that distances in color spaces such as YUV
  1570. or YIQ correspond to perceptual color differences more closely
  1571. than do distances in RGB space.  These color spaces may give better
  1572. results when color reducing an image.  Refer to \fBQuantize(9)\fP for
  1573. more details.
  1574. X
  1575. The \fB-colors\fP or \fB-monochrome\fP option is required for this option
  1576. to take effect.
  1577. .TP 5
  1578. .B "-compress \fItype\fP"
  1579. the type of image compression: \fIQEncoded\fP or \fIRunlengthEncoded\fP.
  1580. X
  1581. Specify \fB\+compress\fP to store the binary image in an uncompressed format.
  1582. The default is the compression type of the specified image file.
  1583. .TP 5
  1584. .B "-density \fI<width>x<height>
  1585. vertical and horizonal density of the image.
  1586. X
  1587. This option specifies an image density whose interpretation changes
  1588. with the type of image.  The default is 72 dots per inch in the
  1589. horizonal and vertical direction for Postscript.  Text files default to
  1590. 80 characters in width and 60 lines in height.  Use this option to
  1591. alter the default density.
  1592. .TP 5
  1593. .B "-display \fIhost:display[.screen]\fP"
  1594. specifies the X server to contact; see \fBX(1)\fP.
  1595. .TP 5
  1596. .B "-dither"
  1597. apply Floyd/Steinberg error diffusion to the image.
  1598. X
  1599. The basic strategy of dithering is to trade intensity resolution for
  1600. spatial resolution by averaging the intensities of several neighboring
  1601. pixels.  Images which suffer from severe contouring when reducing colors
  1602. can be improved with this option.
  1603. X
  1604. The \fB-colors\fP option is required for dithering to take effect.
  1605. .TP 5
  1606. .B "-geometry \fI<width>x<height>\fP"
  1607. the width and height of the image.  
  1608. X
  1609. Use this option to specified the width and height of raw images whose
  1610. dimensions are unknown such as GRAY, RGB, and CMYK.  This option can
  1611. also change the default 8.5 by 11 width and height of the Postscript
  1612. canvas.
  1613. .TP 5
  1614. .B "-quality \fIvalue\fP"
  1615. JPEG quality setting.  Quality is 0 (worst) to 100 (best). The default is
  1616. 75.
  1617. .TP 5
  1618. .B "-scene \fIvalue\fP"
  1619. image scene number.
  1620. .TP 5
  1621. .B "-treedepth \fIvalue\fP"
  1622. Normally, this integer value is zero or one.  A zero or one tells
  1623. \fIDisplay\fP to choose a optimal tree depth for the color reduction
  1624. algorithm.
  1625. X
  1626. An optimal depth generally allows the best representation of the source
  1627. image with the fastest computational speed and the least amount of
  1628. memory.  However, the default depth is inappropriate for some images.
  1629. To assure the best representation, try values between 2 and 8 for this
  1630. parameter.  Refer to \fBQuantize(9)\fP for more details.
  1631. X
  1632. The \fB-colors\fP option is required for this option to take effect.
  1633. .TP 5
  1634. .B -verbose
  1635. print detailed information about the image.
  1636. X
  1637. This information is printed: image scene number;  image name;  converted
  1638. image name;  image size;  the image class (\fIDirectClass\fP or 
  1639. \fIPseudoClass\fP);  the total number of unique colors;  and the number
  1640. of seconds to read and convert the image.
  1641. .PP
  1642. Change '-' to '+' in any option above to reverse its effect.  For
  1643. example, specify +alpha to store the image without its alpha channel.
  1644. .PP
  1645. To specify a particular image format prefix \fIfile\fP with the image
  1646. type and a colon (i.e. mtv:image) or specify the image type as the
  1647. filename suffix (i.e. image.mtv).  See the beginning of this document
  1648. for a list of valid image formats.  If \fIfile\fP has the extension
  1649. \fB.Z\fP, the file size is reduced using Lempel-Ziv coding with
  1650. \fBcompress\fP.  If \fIfile\fP already exists, you will be prompted as
  1651. to whether it should be overwritten.
  1652. X
  1653. When you specify \fBX\fP as your image type, the filename has special
  1654. meaning.  It specifies an X window by id, name, or \fBroot\fP.  If no
  1655. filename is specified, the window is selected by clicking the mouse in
  1656. the desired window.
  1657. .SH ENVIRONMENT
  1658. .PP
  1659. .TP 5
  1660. .B DISPLAY
  1661. To get the default host, display number, and screen.
  1662. .SH SEE ALSO
  1663. display(1), animate(1), mogrify(1), Quantize(9), X(1), MIFF(5)
  1664. .SH COPYRIGHT
  1665. SHAR_EOF
  1666. true || echo 'restore of ImageMagick/utilities/convert.man failed'
  1667. fi
  1668. echo 'End of  part 25'
  1669. echo 'File ImageMagick/utilities/convert.man is continued in part 26'
  1670. echo 26 > _shar_seq_.tmp
  1671. exit 0
  1672. exit 0 # Just in case...
  1673.