home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume34 / imagemagick / part02 < prev    next >
Encoding:
Text File  |  1992-12-14  |  57.1 KB  |  1,644 lines

  1. Newsgroups: comp.sources.misc
  2. From: cristy@eplrx7.es.duPont.com (John Cristy)
  3. Subject:  v34i030:  imagemagick - X11 image processing and display v2.2, Part02/26
  4. Message-ID: <1992Dec13.202231.7585@sparky.imd.sterling.com>
  5. X-Md4-Signature: a4d4fb489fd5de30ba971d79d788ebb1
  6. Date: Sun, 13 Dec 1992 20:22:31 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: cristy@eplrx7.es.duPont.com (John Cristy)
  10. Posting-number: Volume 34, Issue 30
  11. Archive-name: imagemagick/part02
  12. Environment: UNIX, VMS, X11, SGI, DEC, Cray, Sun, Vax
  13.  
  14. #!/bin/sh
  15. # this is Part.02 (part 2 of a multipart archive)
  16. # do not concatenate these parts, unpack them in order with /bin/sh
  17. # file ImageMagick/colors.c continued
  18. #
  19. if test ! -r _shar_seq_.tmp; then
  20.     echo 'Please unpack part 1 first!'
  21.     exit 1
  22. fi
  23. (read Scheck
  24.  if test "$Scheck" != 2; then
  25.     echo Please unpack part "$Scheck" next!
  26.     exit 1
  27.  else
  28.     exit 0
  29.  fi
  30. ) < _shar_seq_.tmp || exit 1
  31. if test ! -f _shar_wnt_.tmp; then
  32.     echo 'x - still skipping ImageMagick/colors.c'
  33. else
  34. echo 'x - continuing file ImageMagick/colors.c'
  35. sed 's/^X//' << 'SHAR_EOF' >> 'ImageMagick/colors.c' &&
  36. %                           Software Design                                   %
  37. %                             John Cristy                                     %
  38. %                              July 1992                                      %
  39. %                                                                             %
  40. %                                                                             %
  41. %  Copyright 1992 E. I. du Pont de Nemours & Company                          %
  42. %                                                                             %
  43. %  Permission to use, copy, modify, distribute, and sell this software and    %
  44. %  its documentation for any purpose is hereby granted without fee,           %
  45. %  provided that the above Copyright notice appear in all copies and that     %
  46. %  both that Copyright notice and this permission notice appear in            %
  47. %  supporting documentation, and that the name of E. I. du Pont de Nemours    %
  48. %  & Company not be used in advertising or publicity pertaining to            %
  49. %  distribution of the software without specific, written prior               %
  50. %  permission.  E. I. du Pont de Nemours & Company makes no representations   %
  51. %  about the suitability of this software for any purpose.  It is provided    %
  52. %  "as is" without express or implied warranty.                               %
  53. %                                                                             %
  54. %  E. I. du Pont de Nemours & Company disclaims all warranties with regard    %
  55. %  to this software, including all implied warranties of merchantability      %
  56. %  and fitness, in no event shall E. I. du Pont de Nemours & Company be       %
  57. %  liable for any special, indirect or consequential damages or any           %
  58. %  damages whatsoever resulting from loss of use, data or profits, whether    %
  59. %  in an action of contract, negligence or other tortious action, arising     %
  60. %  out of or in connection with the use or performance of this software.      %
  61. %                                                                             %
  62. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  63. %
  64. %
  65. %
  66. */
  67. X
  68. /*
  69. X  Include declarations.
  70. */
  71. #include "display.h"
  72. #include "image.h"
  73. /*
  74. X  Define declarations.
  75. */
  76. #define MaxTreeDepth  8  /* Log2(MaxRGB) */
  77. #define NodesInAList  2048
  78. X
  79. /*
  80. X  Structures.
  81. */
  82. typedef struct _Node
  83. {
  84. X  struct _Node
  85. X    *child[8];
  86. X
  87. X  unsigned char
  88. X    mid_red,
  89. X    mid_green,
  90. X    mid_blue;
  91. } Node;
  92. X
  93. typedef struct _Nodes
  94. {
  95. X  Node
  96. X    nodes[NodesInAList];
  97. X
  98. X  struct _Nodes
  99. X    *next;
  100. } Nodes;
  101. X
  102. typedef struct _Cube
  103. {
  104. X  Node
  105. X    *root,
  106. X    *leaf;
  107. X
  108. X  unsigned int
  109. X    colors;
  110. X
  111. X  unsigned int
  112. X    free_nodes;
  113. X
  114. X  Node
  115. X    *node;
  116. X
  117. X  Nodes
  118. X    *node_list;
  119. } Cube;
  120. X
  121. /*
  122. X  Global variables.
  123. */
  124. static Cube
  125. X  cube;
  126. X
  127. /*
  128. X  External declarations.
  129. */
  130. extern char
  131. X  *application_name;
  132. X
  133. /*
  134. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  135. %                                                                             %
  136. %                                                                             %
  137. %                                                                             %
  138. %  I n i t i a l i z e N o d e                                                %
  139. %                                                                             %
  140. %                                                                             %
  141. %                                                                             %
  142. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  143. %
  144. %  Function InitializeNode allocates memory for a new node in the color cube
  145. %  tree and presets all fields to zero.
  146. %
  147. %  The format of the InitializeNode routine is:
  148. %
  149. %      node=InitializeNode(mid_red,mid_green,mid_blue)
  150. %
  151. %  A description of each parameter follows.
  152. %
  153. %    o mid_red: Specifies the mid point of the red axis for this node.
  154. %
  155. %    o mid_green: Specifies the mid point of the green axis for this node.
  156. %
  157. %    o mid_blue: Specifies the mid point of the blue axis for this node.
  158. %
  159. %
  160. */
  161. static Node *InitializeNode(mid_red,mid_green,mid_blue)
  162. register unsigned char
  163. X  mid_red,
  164. X  mid_green,
  165. X  mid_blue;
  166. {
  167. X  register int
  168. X    i;
  169. X
  170. X  register Node
  171. X    *node;
  172. X
  173. X  if (cube.free_nodes == 0)
  174. X    {
  175. X      register Nodes
  176. X        *nodes;
  177. X
  178. X      /*
  179. X        Allocate a new nodes of nodes.
  180. X      */
  181. X      nodes=(Nodes *) malloc(sizeof(Nodes));
  182. X      if (nodes == (Nodes *) NULL)
  183. X        return((Node *) NULL);
  184. X      nodes->next=cube.node_list;
  185. X      cube.node_list=nodes;
  186. X      cube.node=nodes->nodes;
  187. X      cube.free_nodes=NodesInAList;
  188. X    }
  189. X  cube.free_nodes--;
  190. X  node=cube.node++;
  191. X  for (i=0; i < 8; i++)
  192. X    node->child[i]=(Node *) NULL;
  193. X  node->mid_red=mid_red;
  194. X  node->mid_green=mid_green;
  195. X  node->mid_blue=mid_blue;
  196. X  return(node);
  197. }
  198. X
  199. /*
  200. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  201. %                                                                             %
  202. %                                                                             %
  203. %                                                                             %
  204. %  N u m b e r C o l o r s                                                    %
  205. %                                                                             %
  206. %                                                                             %
  207. %                                                                             %
  208. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  209. %
  210. %  Function NumberColors returns the number of unique colors in an image.
  211. %
  212. %  The format of the NumberColors routine is:
  213. %
  214. %      number_colors=NumberColors(image)
  215. %
  216. %  A description of each parameter follows.
  217. %
  218. %    o image: The address of a byte (8 bits) array of run-length
  219. %      encoded pixel data of your source image.  The sum of the
  220. %      run-length counts in the source image must be equal to or exceed
  221. %      the number of pixels.
  222. %
  223. %
  224. */
  225. unsigned int NumberColors(image)
  226. Image
  227. X  *image;
  228. {
  229. X  Nodes
  230. X    *nodes;
  231. X
  232. X  register RunlengthPacket
  233. X    *p;
  234. X
  235. X  register int
  236. X    i;
  237. X
  238. X  register Node
  239. X    *node;
  240. X
  241. X  register unsigned char
  242. X    bisect,
  243. X    id;
  244. X
  245. X  register unsigned int
  246. X    level;
  247. X
  248. X  /*
  249. X    Initialize color description tree.
  250. X  */
  251. X  cube.node_list=(Nodes *) NULL;
  252. X  cube.colors=0;
  253. X  cube.free_nodes=0;
  254. X  cube.root=InitializeNode(MaxRGB >> 1,MaxRGB >> 1,MaxRGB >> 1);
  255. X  cube.leaf=InitializeNode(0,0,0);
  256. X  if ((cube.root == (Node *) NULL) || (cube.leaf == (Node *) NULL))
  257. X    {
  258. X      Warning("unable to count colors","memory allocation failed");
  259. X      return(0);
  260. X    }
  261. X  p=image->pixels;
  262. X  for (i=0; i < image->packets; i++)
  263. X  {
  264. X    /*
  265. X      Start at the root and proceed level by level.
  266. X    */
  267. X    node=cube.root;
  268. X    for (level=1; level < MaxTreeDepth; level++)
  269. X    {
  270. X      id=(p->red >= node->mid_red ? 1 : 0) |
  271. X        (p->green >= node->mid_green ? 1 : 0) << 1 |
  272. X        (p->blue >= node->mid_blue ? 1 : 0) << 2;
  273. X      if (node->child[id] == (Node *) NULL)
  274. X        {
  275. X          bisect=(unsigned int) (1 << (MaxTreeDepth-level)) >> 1;
  276. X          node->child[id]=InitializeNode(
  277. X            node->mid_red+(id & 1 ? bisect : -bisect),
  278. X            node->mid_green+(id & 2 ? bisect : -bisect),
  279. X            node->mid_blue+(id & 4 ? bisect : -bisect));
  280. X          if (node->child[id] == (Node *) NULL)
  281. X            {
  282. X              Warning("unable to count colors","memory allocation failed");
  283. X              return(0);
  284. X            }
  285. X        }
  286. X      node=node->child[id];
  287. X    }
  288. X    id=(p->red >= node->mid_red ? 1 : 0) |
  289. X      (p->green >= node->mid_green ? 1 : 0) << 1 |
  290. X      (p->blue >= node->mid_blue ? 1 : 0) << 2;
  291. X    if (node->child[id] == (Node *) NULL)
  292. X      {
  293. X        node->child[id]=cube.leaf;
  294. X        cube.colors++;
  295. X      }
  296. X    p++;
  297. X  }
  298. X  /*
  299. X    Release color cube tree storage.
  300. X  */
  301. X  do
  302. X  {
  303. X    nodes=cube.node_list->next;
  304. X    (void) free((char *) cube.node_list);
  305. X    cube.node_list=nodes;
  306. X  }
  307. X  while (cube.node_list != (Nodes *) NULL);
  308. X  return(cube.colors);
  309. }
  310. SHAR_EOF
  311. echo 'File ImageMagick/colors.c is complete' &&
  312. chmod 0644 ImageMagick/colors.c ||
  313. echo 'restore of ImageMagick/colors.c failed'
  314. Wc_c="`wc -c < 'ImageMagick/colors.c'`"
  315. test 9232 -eq "$Wc_c" ||
  316.     echo 'ImageMagick/colors.c: original size 9232, current size' "$Wc_c"
  317. rm -f _shar_wnt_.tmp
  318. fi
  319. # ============= ImageMagick/Make.com ==============
  320. if test -f 'ImageMagick/Make.com' -a X"$1" != X"-c"; then
  321.     echo 'x - skipping ImageMagick/Make.com (File already exists)'
  322.     rm -f _shar_wnt_.tmp
  323. else
  324. > _shar_wnt_.tmp
  325. echo 'x - extracting ImageMagick/Make.com (Text)'
  326. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/Make.com' &&
  327. $!
  328. $! Make ImageMagick X image utilities for VMS.
  329. $!
  330. $
  331. $define/nolog X11 decw$include:
  332. $define/nolog sys sys$library:
  333. $link_options="/nodebug/notraceback"
  334. $define/nolog lnk$library sys$library:vaxcrtl
  335. $
  336. $if ((p1.nes."").and.(p1.nes."display")) then goto SkipDisplay
  337. $write sys$output "Making Display..."
  338. $call Make display
  339. $call Make X
  340. $call Make image
  341. $call Make rotate
  342. $call Make quantize
  343. $call Make colors
  344. $call Make signature
  345. $call Make compress
  346. $call Make alien
  347. $call Make PreRvIcccm
  348. $
  349. $link'link_options' display,X,image,rotate,quantize,colors,signature, -
  350. X  compress,alien,PreRvIcccm,sys$input:/opt
  351. sys$share:decw$xlibshr.exe/share
  352. $
  353. $display:==$'f$environment("default")'display
  354. $write sys$output "..symbol DISPLAY defined."
  355. $
  356. $SkipDisplay:
  357. $if ((p1.nes."").and.(p1.nes."import")) then goto SkipImport
  358. $write sys$output "Making Import..."
  359. $call Make import
  360. $call Make X
  361. $call Make image
  362. $call Make rotate
  363. $call Make quantize
  364. $call Make colors
  365. $call Make signature
  366. $call Make compress
  367. $call Make alien
  368. $call Make PreRvIcccm
  369. $
  370. $link'link_options' import,X,image,rotate,quantize,colors,signature,compress, -
  371. X  alien,PreRvIcccm,sys$input:/opt
  372. sys$share:decw$xlibshr.exe/share
  373. $
  374. $import:==$'f$environment("default")'import
  375. $write sys$output "..symbol IMPORT defined."
  376. $SkipImport:
  377. $
  378. $if ((p1.nes."").and.(p1.nes."XtoPS")) then goto SkipXtoPS
  379. $write sys$output "Making XtoPS..."
  380. $call Make XtoPS
  381. $call Make X
  382. $call Make image
  383. $call Make rotate
  384. $call Make quantize
  385. $call Make colors
  386. $call Make signature
  387. $call Make compress
  388. $call Make PreRvIcccm
  389. $
  390. $link'link_options' XtoPS,X,image,rotate,quantize,colors,signature,compress, -
  391. X  alien,PreRvIcccm,sys$input:/opt
  392. sys$share:decw$xlibshr.exe/share
  393. $
  394. $XtoPS:== $'f$environment("default")'XtoPS
  395. $write sys$output "..symbol XTOPS defined."
  396. $
  397. $SkipXtoPS:
  398. $if ((p1.nes."").and.(p1.nes."animate")) then goto SkipAnimate
  399. $write sys$output "Making Animate..."
  400. $call Make animate
  401. $call Make X
  402. $call Make image
  403. $call Make rotate
  404. $call Make quantize
  405. $call Make colors
  406. $call Make signature
  407. $call Make compress
  408. $call Make alien
  409. $call Make PreRvIcccm
  410. $
  411. $link'link_options' animate,X,image,rotate,quantize,colors,signature, -
  412. X  compress,alien,PreRvIcccm,sys$input:/opt
  413. sys$share:decw$xlibshr.exe/share
  414. $
  415. $animate:==$'f$environment("default")'animate
  416. $write sys$output "..symbol ANIMATE defined."
  417. $
  418. $SkipAnimate:
  419. $if ((p1.nes."").and.(p1.nes."montage")) then goto SkipMontage
  420. $write sys$output "Making Montage..."
  421. $call Make montage
  422. $call Make X
  423. $call Make image
  424. $call Make rotate
  425. $call Make quantize
  426. $call Make colors
  427. $call Make compress
  428. $call Make alien
  429. $call Make PreRvIcccm
  430. $
  431. $link'link_options' montage,X,image,rotate,quantize,colors,signature, -
  432. X  compress,alien,PreRvIcccm,sys$input:/opt
  433. sys$share:decw$xlibshr.exe/share
  434. $
  435. $montage:==$'f$environment("default")'montage
  436. $write sys$output "..symbol MONTAGE defined."
  437. $
  438. $SkipMontage:
  439. $type sys$input
  440. X
  441. Use this command to specify which X server to contact:
  442. X
  443. X  $set display/create/node=node_name::
  444. X
  445. This can be done automatically from your LOGIN.COM with the following 
  446. command:
  447. X
  448. X  $if (f$trnlmn("sys$rem_node").nes."") then -
  449. X  $  set display/create/node='f$trnlmn("sys$rem_node")'
  450. $write sys$output "Making in [.utilities]"
  451. $set default [.utilities]
  452. $@make
  453. $exit
  454. $
  455. $Make: subroutine
  456. $!
  457. $! A very primitive "make" (or MMS) hack for DCL.
  458. $!
  459. $if (p1.eqs."") then exit
  460. $source_file=f$search(f$parse(p1,".c"))
  461. $if (source_file.nes."")
  462. $  then
  463. $    object_file=f$parse(source_file,,,"name")+".obj"
  464. $    object_file=f$search( object_file )
  465. $    if (object_file.nes."") 
  466. $      then
  467. $        object_time=f$file_attribute(object_file,"cdt")
  468. $        source_time=f$file_attribute(source_file,"cdt")
  469. $        if (f$cvtime(object_time).lts.f$cvtime(source_time)) then -
  470. $          object_file=""
  471. $      endif
  472. $    if (object_file.eqs."") 
  473. $      then
  474. $        write sys$output "Compiling ",p1
  475. $        cc/nodebug/optimize 'source_file'
  476. $      endif
  477. $  endif
  478. $exit
  479. $endsubroutine
  480. SHAR_EOF
  481. chmod 0644 ImageMagick/Make.com ||
  482. echo 'restore of ImageMagick/Make.com failed'
  483. Wc_c="`wc -c < 'ImageMagick/Make.com'`"
  484. test 3952 -eq "$Wc_c" ||
  485.     echo 'ImageMagick/Make.com: original size 3952, current size' "$Wc_c"
  486. rm -f _shar_wnt_.tmp
  487. fi
  488. # ============= ImageMagick/display.h ==============
  489. if test -f 'ImageMagick/display.h' -a X"$1" != X"-c"; then
  490.     echo 'x - skipping ImageMagick/display.h (File already exists)'
  491.     rm -f _shar_wnt_.tmp
  492. else
  493. > _shar_wnt_.tmp
  494. echo 'x - extracting ImageMagick/display.h (Text)'
  495. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/display.h' &&
  496. /*
  497. X  Include declarations
  498. */
  499. #include <stdio.h>
  500. #if defined(__STDC__) || defined(sgi) || defined(AIXV3)
  501. #include <stdlib.h>
  502. #include <unistd.h>
  503. #else
  504. #ifndef vms
  505. #include <malloc.h>
  506. #include <memory.h>
  507. #endif
  508. #endif
  509. #include <ctype.h>
  510. #include <string.h>
  511. #include <math.h>
  512. #undef index
  513. X
  514. /*
  515. X  Define declarations for the Display program.
  516. */
  517. #if __STDC__ || defined(sgi) || defined(AIXV3)
  518. #define _Declare(formal_parameters) formal_parameters
  519. #else
  520. #define const 
  521. #define _Declare(formal_parameters) ()
  522. #endif
  523. #define DownShift(x) ((int) ((x)+(1L << 15)) >> 16)
  524. #define False  0
  525. #define Max(x,y)  (((x) > (y)) ? (x) : (y))
  526. #define Min(x,y)  (((x) < (y)) ? (x) : (y))
  527. #define MinInfoSize (1 << 18)
  528. #define True  1
  529. #define UpShift(x) ((x) << 16)
  530. #define UpShifted(x) ((int) ((x)*(1L << 16)+0.5))
  531. #define Warning(message,qualifier)  \
  532. {  \
  533. X  (void) fprintf(stderr,"%s: %s",application_name,message);  \
  534. X  if (qualifier != (char *) NULL)  \
  535. X    (void) fprintf(stderr," (%s)",qualifier);  \
  536. X  (void) fprintf(stderr,".\n");  \
  537. }
  538. #ifdef vms
  539. #define pclose(file)  exit(1)
  540. #define popen(command,mode)  exit(1)
  541. #define unlink(file)  remove(file)
  542. #endif
  543. X
  544. /*
  545. X  Variable declarations.
  546. */
  547. #ifndef lint
  548. static char 
  549. X  Version[]="@(#)ImageMagick 2.2 92/12/10 cristy@dupont.com";
  550. #endif
  551. SHAR_EOF
  552. chmod 0644 ImageMagick/display.h ||
  553. echo 'restore of ImageMagick/display.h failed'
  554. Wc_c="`wc -c < 'ImageMagick/display.h'`"
  555. test 1270 -eq "$Wc_c" ||
  556.     echo 'ImageMagick/display.h: original size 1270, current size' "$Wc_c"
  557. rm -f _shar_wnt_.tmp
  558. fi
  559. # ============= ImageMagick/display.man ==============
  560. if test -f 'ImageMagick/display.man' -a X"$1" != X"-c"; then
  561.     echo 'x - skipping ImageMagick/display.man (File already exists)'
  562.     rm -f _shar_wnt_.tmp
  563. else
  564. > _shar_wnt_.tmp
  565. echo 'x - extracting ImageMagick/display.man (Text)'
  566. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/display.man' &&
  567. .ad l
  568. .nh
  569. .TH DISPLAY 1 "10 October 1992" "ImageMagick"
  570. .SH NAME
  571. display - display an image on any workstation running X
  572. .SH SYNOPSIS
  573. .B "display" [ \fIoptions\fP ...] \fIfile\fP
  574. [ [ \fIoptions\fP ...] \fIfile\fP ...]
  575. .SH DESCRIPTION
  576. \fIDisplay\fP is a machine architecture independent image processing
  577. and display program.  It can display an image on any workstation
  578. display running an X server.  \fIDisplay\fP first determines the
  579. hardware capabilities of the workstation.  If the number of unique
  580. colors in the image is less than or equal to the number the workstation
  581. can support, the image is displayed in an X window.  Otherwise the
  582. number of colors in the image is first reduced to match the color
  583. resolution of the workstation before it is displayed.
  584. .PP
  585. This means that a continuous-tone 24 bits-per-pixel image can display on a
  586. 8 bit pseudo-color device or monochrome device.  In most instances the
  587. reduced color image closely resembles the original.  Alternatively, a
  588. monochrome or pseudo-color image can display on a continuous-tone 24
  589. bits-per-pixel device.
  590. .SH EXAMPLES
  591. To scale an image of a cockatoo to exactly 640 pixels in width and 480
  592. pixels in height and position the window at location (200,200), use:
  593. .PP
  594. X     display -geometry 640x480\+200\+200 cockatoo.miff
  595. .PP
  596. To display an image of a cockatoo without a border centered on a
  597. backdrop, use:
  598. .PP
  599. X     display +borderwidth -backdrop cockatoo.miff
  600. .PP
  601. To tile an image of a cockatoo onto the root window, use:
  602. .PP
  603. X     display -window root cockatoo.miff
  604. .SH OPTIONS
  605. .TP 5
  606. .B "-backdrop"
  607. display the image centered on a backdrop.
  608. X
  609. This backdrop covers the entire workstation screen and is useful for
  610. hiding other X window activity while viewing the image.   The color of
  611. the backdrop is specified as the background color.  Refer to \fBX
  612. RESOURCES\fP for details.
  613. .TP 5
  614. .B "-clip \fI<width>x<height>{\+-}<x offset>{\+-}<y offset>\fP"
  615. preferred size and location of the clipped image.  See \fBX(1)\fP for details
  616. about the geometry specification.
  617. X
  618. Use clipping to apply image processing options to, or display, a
  619. particular area of an image.
  620. X
  621. The equivalent X resource for this option is \fBclipGeometry\fP
  622. (class \fBClipGeometry\fP).  See \fBX RESOURCES\fP for details.
  623. .TP 5
  624. .B "-colormap \fItype\fP"
  625. the type of colormap: \fIShared\fP or \fIPrivate\fP.
  626. X
  627. This option only applies when the default X server visual is
  628. \fIPseudoColor\fP or \fIGrayScale\fP.  Refer to \fB-visual\fP for more
  629. details.  By default, a shared colormap is allocated.  The image shares
  630. colors with other X clients.  Some image colors could be approximated,
  631. therefore your image may look very different than intended.  Choose
  632. \fIPrivate\fP and the image colors appear exactly as they are
  633. defined.  However, other clients may go "technicolor" when the image
  634. colormap is installed.
  635. .TP 5
  636. .B "-colors \fIvalue\fP"
  637. preferred number of colors in the image.
  638. X
  639. The actual number of colors in the image may be less than your request,
  640. but never more.  Note, this is a color reduction option.  Images with
  641. less unique colors than specified with this option will remain unchanged.
  642. Refer to \fBQuantize(9)\fP for more details.
  643. X
  644. Note, options \fB-dither\fP, \fB-colorspace\fP, and \fB-treedepth\fP affect
  645. the color reduction algorithm.
  646. .TP 5
  647. .B "-colorspace \fIvalue\fP"
  648. the type of colorspace: \fIGRAY\fP, \fIRGB\fP, \fIXYZ\fP, \fIYIQ\fP, or
  649. \fIYUV\fP.
  650. X
  651. Color reduction, by default, takes place in the RGB color space.
  652. Empirical evidence suggests that distances in color spaces such as YUV
  653. or YIQ correspond to perceptual color differences more closely
  654. than do distances in RGB space.  These color spaces may give better
  655. results when color reducing an image.  Refer to \fBQuantize(9)\fP for
  656. more details.
  657. X
  658. The \fB-colors\fP or \fB-monochrome\fP option is required for this option
  659. to take effect.
  660. .TP 5
  661. .B "-compress \fItype\fP"
  662. the type of image compression: \fIQEncoded\fP or \fIRunlengthEncoded\fP.
  663. X
  664. Use this option with \fB-write\fP to specify the the type of image
  665. compression.  See \fBMIFF(5)\fP for details.
  666. X
  667. Specify \fB\+compress\fP to store the binary image in an uncompressed format.
  668. The default is the compression type of the specified image file.
  669. .TP 5
  670. .B "-delay \fIseconds\fP"
  671. display the next image after pausing.
  672. X
  673. This option is useful when viewing several images in sequence.  Each
  674. image will display and wait the number of seconds specified before the
  675. next image is displayed.  The default is to display the image
  676. and wait until you choose to display the next image or terminate the
  677. program.
  678. .TP 5
  679. .B "-density \fI<width>x<height>
  680. vertical and horizonal density of the image.
  681. X
  682. This option specifies an image density whose interpretation changes
  683. with the type of image.  The default is 72 dots per inch in the
  684. horizonal and vertical direction for Postscript.  Text files default to
  685. 80 characters in width and 60 lines in height.  Use this option to
  686. alter the default density.
  687. .TP 5
  688. .B "-display \fIhost:display[.screen]\fP"
  689. specifies the X server to contact; see \fBX(1)\fP.
  690. .TP 5
  691. .B "-dither"
  692. apply Floyd/Steinberg error diffusion to the image.
  693. X
  694. The basic strategy of dithering is to trade intensity resolution for
  695. spatial resolution by averaging the intensities of several neighboring
  696. pixels.  Images which suffer from severe contouring when reducing colors
  697. can be improved with this option.
  698. X
  699. The \fB-colors\fP or \fB-monochrome\fP option is required
  700. for this option to take effect.
  701. .TP 5
  702. .B "-enhance"
  703. apply a digital filter to enhance a noisy image.
  704. .TP 5
  705. .B "-gamma \fIvalue\fP"
  706. level of gamma correction.
  707. X
  708. The same color image displayed on two different workstations may look
  709. different due to differences in the display monitor.  Use gamma
  710. correction to adjust for this color difference.  Reasonable values
  711. extend from 0.8 to 2.3.
  712. .TP 5
  713. .B "-geometry \fI<width>x<height>{\+-}<x offset>{\+-}<y offset>\fP"
  714. preferred size and location of the image window.  See \fBX(1)\fP for details
  715. about the geometry specification.  By default, the window size is the image
  716. size and the location is choosen by you when it is mapped.
  717. X
  718. If the specified image size is smaller than the actual image size, the
  719. image is first reduced to an integral of the specified image size with
  720. an antialias digital filter.  The image is then scaled to the exact
  721. specified image size with pixel replication.  If the specified image
  722. size is greater than the actual image size, the image is first enlarged
  723. to an integral of the specified image size with bilinear
  724. interpolation.  The image is then scaled to the exact specified image
  725. size with pixel replication.
  726. X
  727. When displaying an image on an X server, \fI<x offset>\fP and
  728. \fI<y offset>\fP is relative to the root window.  When printing an image,
  729. \fI<x offset>\fP and \fI<y offset>\fP is relative to a Postscript
  730. page.  See \fB-print\fP for more details.
  731. X
  732. The equivalent X resource for this option is \fBimageGeometry\fP
  733. (class \fBImageGeometry\fP).  See \fBX RESOURCES\fP for details.
  734. .TP 5
  735. .B "-inverse"
  736. apply color inversion to image.
  737. X
  738. The red, green, and blue intensities of an image are negated.
  739. .TP 5
  740. .B "-map \fItype\fP"
  741. display image using this Standard Colormap type.
  742. X
  743. Choose from these Standard Colormap types:
  744. X
  745. X    default
  746. X    best
  747. X    red
  748. X    green
  749. X    blue
  750. X    gray
  751. X
  752. The X server must support the Standard Colormap you choose, otherwise an
  753. error occurs.  See \fBxstdcmap(1)\fP for one way of creating Standard
  754. Colormaps.
  755. .TP 5
  756. .B "-monochrome"
  757. transform the image to black and white.
  758. X
  759. Monochrome images can benefit from error diffusion.  Use \fB-dither\fP with
  760. this option to diffuse the error.
  761. .TP 5
  762. .B "-noise"
  763. reduce the noise in an image with a noise peak elimination filter.
  764. X
  765. The principal function of noise peak elimination filter is to smooth
  766. the objects within an image without losing edge information and without
  767. creating undesired structures.  The central idea of the algorithm is to
  768. replace a pixel with its next neighbor in value within a 3 x 3 window,
  769. if this pixel has been found to be noise.  A pixel is defined as noise
  770. if and only if this pixel is a maximum or minimum within the 3 x 3 window.
  771. .TP 5
  772. .B "-normalize"
  773. tranform image to span the full range of color values.  This is a contrast
  774. enhancement technique.
  775. .TP 5
  776. .B "-print \fIfile\fP"
  777. write image as encapsulated Postscript to a file.
  778. X
  779. If \fIfile\fP already exists, you will be prompted as to whether
  780. it should be overwritten.
  781. X
  782. By default, the image is scaled and centered to fit on an 612x792 point
  783. Postscript page.  To specify a specific image size or a particular location on
  784. the Postscript page, use \fB-geometry\fP.
  785. X
  786. By default the image is output in portrait mode.  Use \fB-rotate 90\fP to
  787. display the image in landscape mode.
  788. X
  789. You can view \fIfile\fP with any Postscript compatible viewer or
  790. printer.  The image is displayed as color on viewers and printers that
  791. support color Postscript, otherwise it is displayed as grayscale.
  792. X
  793. The equivalent X resource for this option is \fBprintFilename\fP
  794. (class \fBPrintFilename\fP).  See \fBX RESOURCES\fP for details.
  795. .TP 5
  796. .B "-reflect"
  797. create a "mirror image" by reflecting the image scanlines.
  798. .TP 5
  799. .B "-rotate \fIdegrees\fP"
  800. apply Paeth image rotation to the image.
  801. .TP 5
  802. .B "-scale \fI<width factor>x<height factor>\fP"
  803. preferred size factors of the image.
  804. X
  805. This option behaves like \fB-geometry\fP except the width and height values
  806. are relative instead of absolute.  The image size is multiplied by the
  807. width and height factors to obtain the final image dimensions.  If only
  808. one factor is specified, both the width and height factors assume the
  809. value.
  810. X
  811. Factors may be fractional.  For example, a factor of 1.5 will increase the
  812. image size by one and one-half.
  813. X
  814. The equivalent X resource for this option is \fBscaleGeometry\fP
  815. (class \fBScaleGeometry\fP).  See \fBX RESOURCES\fP for details.
  816. .TP 5
  817. .B "-scene \fIvalue\fP"
  818. image scene number.
  819. .TP 5
  820. .B "-treedepth \fIvalue\fP"
  821. Normally, this integer value is zero or one.  A zero or one tells
  822. \fIdisplay\fP to choose a optimal tree depth for the color reduction
  823. algorithm.
  824. X
  825. An optimal depth generally allows the best representation of the source
  826. image with the fastest computational speed and the least amount of
  827. memory.  However, the default depth is inappropriate for some images.
  828. To assure the best representation, try values between 2 and 8 for this
  829. parameter.  Refer to \fBQuantize(9)\fP for more details.
  830. X
  831. The \fB-colors\fP or \fB-monochrome\fP option is required
  832. for this option to take effect.
  833. .TP 5
  834. .B -verbose
  835. print detailed information about the image.
  836. X
  837. This information is printed: image scene number;  image name;  image
  838. size; the image class (\fIDirectClass\fP or \fIPseudoClass\fP);  the total
  839. number of unique colors;  and the number of seconds to read and
  840. transform the image.  Refer to \fBMIFF(5)\fP for a description of
  841. the image class.
  842. X
  843. If \fB-colors\fP is also specified, the total unique colors in the image
  844. and color reduction error values are printed.  Refer to \fBQuantize(9)\fP
  845. for a description of these values.
  846. .TP 5
  847. .B "-visual \fItype\fP"
  848. display image using this visual type.
  849. X
  850. Choose from these visual classes:
  851. X
  852. X    StaticGray
  853. X    GrayScale
  854. X    StaticColor
  855. X    PseudoColor
  856. X    TrueColor
  857. X    DirectColor
  858. X    default
  859. X    \fIvisual id\fP
  860. X
  861. The X server must support the visual you choose, otherwise an error occurs.
  862. If a visual is not specified, the visual class that can display the most
  863. simultaneous colors on the default X server screen is choosen.
  864. .TP 5
  865. .B "-window \fIid\fP"
  866. set the background pixmap of this window to the image.
  867. X
  868. \fIid\fP can be a window id or name.  Specify \fBroot\fP to select X's root
  869. window as the target window.
  870. X
  871. By default the image is tiled onto the background of the target
  872. window.   If \fB-backdrop\fP or \fB-geometry\fP are specified, the
  873. image is surrounded by the background color.  Refer to \fBX
  874. RESOURCES\fP for details.
  875. X
  876. The image will not display on the root window if the image has more
  877. unique colors than the target window colormap allows.  Use
  878. \fB-colors\fP to reduce the number of colors.
  879. .TP 5
  880. .B "-write \fIfile\fP"
  881. write image to a file.
  882. X
  883. If \fIfile\fP already exists, you will be prompted as to whether
  884. it should be overwritten.
  885. X
  886. By default, the image is stored in the MIFF image format.  If the number of
  887. unique colors in the image exceed 65535, it is stored as \fIDirectClass\fP;
  888. otherwise, it is stored as \fIPseudoClass\fP format.  Refer to \fBMIFF(5)\fP
  889. for more details.
  890. X
  891. By default, the image is written in the format that it was read in as.
  892. To specify a particular image format, prefix \fIfile\fP with the image
  893. type and a colon (i.e. mtv:image) or specify the image type as the
  894. filename suffix (i.e. image.mtv).  See \fBconvert(1)\fP for a list of
  895. valid image formats.  If \fIfile\fP has the extension \fB.Z\fP, the
  896. file size is reduced using Lempel-Ziv coding with \fBcompress\fP.  If
  897. \fIfile\fP already exists, you will be prompted as to whether it should
  898. be overwritten.
  899. X
  900. Use \fB-compress\fP to specify the type of image compression.
  901. X
  902. The equivalent X resource for this option is \fBwriteFilename\fP
  903. (class \fBWriteFilename\fP).  See \fBX RESOURCES\fP for details.
  904. .PP
  905. In addition to those listed above, you can specify these standard X
  906. resources as command line options:  \fB-background\fP,
  907. \fB-bordercolor\fP, \fB-borderwidth\fP,  \fB-font\fP,
  908. \fB-foreground\fP, \fB-iconGeometry\fP, \fB-iconic\fP, \fB-name\fP, or
  909. \fB-title\fP.  See \fBX RESOURCES\fP for details.
  910. .PP
  911. Any option you specify on the command line remains in effect until it is
  912. explicitly changed by specifying the option again with a different effect.
  913. For example to display two images, the first with 32 colors, and the
  914. second with only 16 colors, use:
  915. .PP
  916. X     display -colors 32 cockatoo.miff -colors 16 macaw.miff
  917. .PP
  918. Change \fI-\fP to \fI\+\fP in any option above to reverse its effect.
  919. For example, specify \fB\+compress\fP to store the binary image in an
  920. uncompressed format.
  921. .PP
  922. \fIfile\fP specifies the image filename.  By default, the image format
  923. is determined by its magic number. To specify a particular image format, precede
  924. the filename with an image format name and a colon (i.e.
  925. mtv:image) or specify the image type as the filename suffix (i.e. image.mtv).
  926. See \fBconvert(1)\fP for a list of valid image formats.  Specify \fIfile\fP
  927. as \fI-\fP for standard input or output.  If \fIfile\fP has the
  928. extension \fB.Z\fP, the file is decoded with \fIuncompress\fP.
  929. .SH BUTTONS
  930. The effects of each button press is described below.  Three buttons are
  931. required.  If you have a two button mouse, button 1 and 3 are returned.
  932. Press ALT and button 3 to simulate button 2.
  933. .TP 5
  934. .B "1"
  935. Press and drag to select a command from a pop-up menu.  Choose from
  936. these commands:
  937. X
  938. X    Image Info
  939. X    Reflect
  940. X    Rotate Right
  941. X    Rotate Left
  942. X    Half Size
  943. X    Double Size
  944. X    Restore
  945. X    Annotate
  946. X    Composite
  947. X    Write
  948. X    Print
  949. X    Next
  950. X    Last
  951. X    Quit
  952. .TP 5
  953. .B "2"
  954. Press and drag to define a region of the image to clip.  Release the button
  955. to crop the image, or return the pointer to the location of the initial button
  956. press to cancel the cropping operation.
  957. .TP 5
  958. .B "3"
  959. Press and drag to define a region of the image to magnify.
  960. X
  961. Note, this button behaves differently for a composite MIFF image
  962. created with \fImontage\fP.  Choose a particular tile of the composite
  963. and press this button, the image represented by the tile is then
  964. displayed.  To return to the composite MIFF image, choose \fINext\fP
  965. from the command menu (refer to Button 1).  See \fBmontage(1)\fP and
  966. \fBMIFF(5)\fP for more details.
  967. X
  968. .SH KEYBOARD ACCELERATORS
  969. .TP 5
  970. .B "i"
  971. Press to display information about the image.  Press any key or button to
  972. erase the information.
  973. X
  974. This information is printed: image scene number; image name; image
  975. size; the visual class (see \fB-visual\fP); and the total number of
  976. unique colors in the image.
  977. .TP 5
  978. .B "r"
  979. Press to reflect the image scanlines.
  980. .TP 5
  981. .B "/"
  982. Press to rotate the image 90 degrees clockwise.
  983. .TP 5
  984. .B "\e"
  985. Press to rotate the image 90 degrees counter-clockwise.
  986. .TP 5
  987. .B "<"
  988. Press to half the image size.
  989. .TP 5
  990. .B ">"
  991. Press to double the image size.
  992. .TP 5
  993. .B "o"
  994. Press to restore the image to its original size.
  995. .TP 5
  996. .B "a"
  997. Press to annotate the image with text.
  998. X
  999. Refer to \fBIMAGE ANNOTATION\fP for more details.
  1000. .TP 5
  1001. .B "c"
  1002. Press to composite the image with another.
  1003. X
  1004. Refer to \fBIMAGE COMPOSITING\fP for more details.
  1005. .TP 5
  1006. .B "w"
  1007. Press to write the image to a file.
  1008. .TP 5
  1009. .B "p"
  1010. Press to print the image to a file.
  1011. .TP 5
  1012. .B "n"
  1013. Press to display the next image.
  1014. .TP 5
  1015. .B "l"
  1016. Press to display the last image.
  1017. .TP 5
  1018. .B "q"
  1019. Press to discard all images and exit program.
  1020. .TP 5
  1021. .B "1-9"
  1022. Press to change the level of magnification.
  1023. .SH "X RESOURCES"
  1024. \fIDisplay\fP options can appear on the command line or in your X
  1025. resource file.  Options on the command line supersede values specified
  1026. in your X resource file.  See \fBX(1)\fP for more information on X
  1027. resources.
  1028. X
  1029. All \fIdisplay\fP options have a corresponding X resource.  In addition,
  1030. \fIdisplay\fP uses the following X resources:
  1031. .TP 5
  1032. .B background (\fPclass\fB Background)
  1033. Specifies the preferred color to use for the image window background.  The
  1034. default is black.
  1035. .TP 5
  1036. .B borderColor (\fPclass\fB BorderColor)
  1037. Specifies the preferred color to use for the image window border.  The
  1038. default is white.
  1039. .TP 5
  1040. .B borderWidth (\fPclass\fB BorderWidth)
  1041. Specifies the width in pixels of the image window border.  The default is 2.
  1042. .TP 5
  1043. .B font (\fPclass\fB Font)
  1044. Specifies the name of the preferred font to use when displaying text
  1045. within the image window.  The default is \fI/g9x15\fP, \fIfixed\fP, or
  1046. \fI/g6x13\fP determined by the image window size.
  1047. .TP 5
  1048. .B font[1-9] (\fPclass\fB Font[1-9])
  1049. Specifies the name of the preferred font to use when annotating the
  1050. image window with text.  The default fonts are \fIfixed\fP,
  1051. \fIvariable\fP, \fI5x8\fP, \fI6x10\fP, \fI7x13bold\fP, \fI8x13bold\fP,
  1052. \fI9x15bold\fP, \fI10x20\fP, and \fI12x24\fP.  Refer to \fBIMAGE
  1053. ANNOTATION\fP for more details.
  1054. .TP 5
  1055. .B foreground (\fPclass\fB Foreground)
  1056. Specifies the preferred color to use for text within the image window.  The
  1057. default is white.
  1058. .TP 5
  1059. .B iconGeometry (\fPclass\fB IconGeometry)
  1060. Specifies the preferred size and position of the application when
  1061. iconified.  It is not necessarily obeyed by all window managers.
  1062. .TP 5
  1063. .B iconic (\fPclass\fB Iconic)
  1064. This resource indicates that you would prefer that the application's
  1065. windows initially not be visible as if the windows had be immediately
  1066. iconified by you.  Window managers may choose not to honor the
  1067. application's request.
  1068. .TP 5
  1069. .B magnify (\fPclass\fB Magnify)
  1070. specifies an integral factor by which the image should be enlarged.  The
  1071. default is 2.
  1072. X
  1073. This value only affects the magnification window which is invoked with
  1074. button number 1 after the image is displayed.  Refer to \fBBUTTONS\fP
  1075. for more details.
  1076. .TP 5
  1077. .B name (\fPclass\fB Name)
  1078. This resource specifies the name under which resources for the
  1079. application should be found.  This resource is useful in shell aliases to
  1080. distinguish between invocations of an application, without resorting to
  1081. creating links to alter the executable file name.  The default is the
  1082. application name.
  1083. .TP 5
  1084. .B pen[1-9] (\fPclass\fB Pen[1-9])
  1085. Specifies the color of the preferred font to use when annotating the
  1086. image window with text.  The default colors are \fIblack\fP,
  1087. \fIblue\fP, \fIgreen\fP, \fIcyan\fP, \fIgray\fP, \fIred\fP,
  1088. \fImagenta\fP, \fIyellow\fP, and \fIwhite\fP.  Refer to \fBIMAGE
  1089. ANNOTATION\fP for more details.
  1090. .TP 5
  1091. .B title (\fPclass\fB Title)
  1092. This resource specifies the title to be used for the image window.  This
  1093. information is sometimes used by a window manager to provide a
  1094. header identifying the window.  The default is the image file name.
  1095. .SH IMAGE PANNING
  1096. When an image exceeds the width or height of the X server screen,
  1097. \fIdisplay\fP maps a small panning window.  The rectangle within the
  1098. panning window shows the area that is currently displayed in the
  1099. the image window.  To "pan" about the image, press and drag the mouse
  1100. within the panning window.  The panning rectangle moves with the mouse
  1101. and the image window is updated to reflect the location of the
  1102. rectangle within the panning window.  When you have selected the area
  1103. of the image you wish to view, just release the mouse button.
  1104. X
  1105. The panning window goes away if the image becomes smaller than the
  1106. dimensions of the X server screen.
  1107. .SH IMAGE ANNOTATION
  1108. An image is annotated with text interactively.  There is no command
  1109. line argument to annotate an image.  To begin, press button 1 and
  1110. choose \fIAnnotate Image\fP from the command menu (see \fBBUTTONS\fP).
  1111. Alternatively, press \fIa\fP in the image window (see \fBKEYBOARD
  1112. ACCELERATORS\fP).  To exit immediately, press \fIESC\fP.
  1113. .PP
  1114. A small window appears showing the location of the cursor in the image
  1115. window.  You are now in \fIannotate mode\fP.  To exit immediately,
  1116. press \fIESC\fP. In \fIannotate mode\fP a button press has a different
  1117. effect than described in \fBBUTTONS\fP.  Press a button to affect this
  1118. behavior:
  1119. .TP 5
  1120. .B "1"
  1121. Press to select a location within the image window to begin entering text.
  1122. .TP 5
  1123. .B "2"
  1124. Press and drag to select a font from a pop-up menu.  Choose from
  1125. these fonts:
  1126. X
  1127. X    fixed
  1128. X    variable
  1129. X    5x8
  1130. X    6x10
  1131. X    7x13bold
  1132. X    8x13bold
  1133. X    9x15bold
  1134. X    10x20
  1135. X    12x24
  1136. X
  1137. Other fonts can be specified by setting the X resources \fBfont1\fP through
  1138. \fBfont9\fP.  Refer to \fBX RESOURCES\fP for more details.
  1139. .TP 5
  1140. .B "3"
  1141. Press and drag to select a font color from a pop-up menu.  Choose from
  1142. these font colors:
  1143. X
  1144. X    black
  1145. X    blue
  1146. X    cyan
  1147. X    green
  1148. X    gray
  1149. X    red
  1150. X    magenta
  1151. X    yellow
  1152. X    white
  1153. X
  1154. Other font colors can be specified by setting the X resources \fBpen1\fP
  1155. through \fBpen9\fP.  Refer to \fBX RESOURCES\fP for more details.
  1156. .PP
  1157. Choosing a font and its color is optional.  The default font is
  1158. \fIfixed\fP and the default color is \fIblack\fP.  However, you must
  1159. choose a location to begin entering text and press button 1.  An
  1160. underscore character will appear at the location of the cursor where
  1161. you pressed button 1.  The cursor changes to a pencil to indicate
  1162. you are in \fItext mode\fP.  To exit immediately, press \fIESC\fP.
  1163. .PP
  1164. In \fItext mode\fP, any key presses will display the character at
  1165. the location of the underscore and advance the underscore cursor.
  1166. Enter your text and once completed press \fIESC\fP to finish your image
  1167. annotation.  To correct errors press \fIBACK SPACE\fP.  To delete an
  1168. entire line of text, press \fIDELETE\fP.  Any text that exceeds the
  1169. boundaries of the image window is automatically continued onto the next
  1170. line.
  1171. .PP
  1172. Before exiting \fItext mode\fP, immediately after pressing the
  1173. \fIESC\fP key, the image is permanently updated with the text you
  1174. entered.  There is no way to `undo' your changes so be careful to
  1175. check your text before you press \fIESC\fP.
  1176. .PP
  1177. The actual color you request for the font is saved in the image.
  1178. However, the color that appears in your image window may be different.
  1179. For example, on a monochrome screen the text will appear black or white even
  1180. if you choose the color red as the font color.  However, the image saved to
  1181. a file with \fB-write\fP will be written with red lettering.  To assure
  1182. the correct color text in the final image, any \fIPseudoClass\fP image
  1183. is promoted to \fIDirectClass\fP (see \fBMIFF(5)\fP).  To
  1184. force a \fIPseudoClass\fP image to remain \fIPseudoClass\fP, use
  1185. \fB-colors\fP.
  1186. .SH IMAGE COMPOSITING
  1187. An image composite is created interactively.  There is no command line
  1188. argument to composite an image.  To begin, press button 1 and choose
  1189. \fIComposite Image\fP from the command menu (see \fBBUTTONS\fP).
  1190. Alternatively, press \fIc\fP in the image window (see \fBKEYBOARD
  1191. ACCELERATORS\fP).
  1192. .PP
  1193. First a popup window is displayed requesting you to enter an image name.  
  1194. Press \fIRETURN\fP, enter 'X:', or type a file name.  Press \fIRETURN\fP if
  1195. you choose not to create a composite image.  When you specify \fBX:\fP
  1196. as your file name, the filename has special meaning.  It specifies an X
  1197. window by id, name, or \fBroot\fP.  If no filename is specified, the
  1198. window is selected by clicking the mouse in the desired window.  See
  1199. \fBXtoPS(1)\fP for details.
  1200. .PP
  1201. A small window appears showing the location of the cursor in the image
  1202. window.  You are now in \fIcomposite mode\fP.  To exit immediately,
  1203. press \fIESC\fP.  In \fIcomposite mode\fP a button press has a
  1204. different effect than described in \fBBUTTONS\fP.  Press a button to
  1205. affect this behavior: 
  1206. .TP 5
  1207. .B "1"
  1208. Press to select a location within \fIimage window\fP to composite your
  1209. image.
  1210. .TP 5
  1211. .B "2"
  1212. Press and drag to select a composite operation from a pop-up menu.
  1213. Choose from these composite operations:
  1214. X
  1215. X    over
  1216. X    in
  1217. X    out
  1218. X    atop
  1219. X    xor
  1220. X    plus
  1221. X    minus
  1222. X    add
  1223. X    subtract
  1224. X    difference
  1225. X    replace
  1226. .PP
  1227. The operations behaves as follows:
  1228. .TP 9
  1229. .B over
  1230. The result will be the union of the two image shapes, with \fIimage\fP
  1231. obscuring \fIimage window\fP in the region of overlap.
  1232. .TP 9
  1233. .B in
  1234. The result is simply \fIimage\fP cut by the shape of \fIimage
  1235. window\fP.  None of the image data of \fIimage window\fP will be in the
  1236. result.
  1237. .TP 9
  1238. .B out
  1239. The resulting image is \fIimage\fP with the shape of \fIimage window\fP
  1240. cut out.
  1241. .TP 9
  1242. .B atop
  1243. The result is the same shape as image \fIimage window\fP, with
  1244. \fIimage\fP obscuring \fIimage window\fP where the image shapes
  1245. overlap.  Note this differs from \fBover\fP because the portion of
  1246. \fIimage\fP outside \fIimage window\fP's shape does not appear in the
  1247. result.
  1248. .TP 9
  1249. .B xor
  1250. The result is the image data from both \fIimage\fP and \fIimage window\fP
  1251. that is outside the overlap region.  The overlap region will be blank.
  1252. .TP 9
  1253. .B plus
  1254. The result is just the sum of the image data.  Output values are
  1255. clipped to 255 (no overflow).  This operation is independent
  1256. of the alpha channels.
  1257. .TP 9
  1258. .B minus
  1259. The result of \fIimage\fP \- \fIimage window\fP, with underflow clipped
  1260. to zero.  The alpha channel is ignored (set to 255, full coverage).
  1261. .TP 9
  1262. .B add
  1263. The result of \fIimage\fP + \fIimage window\fP, with overflow wrapping
  1264. around (\fImod\fP 256).
  1265. .TP 9
  1266. .B subtract
  1267. The result of \fIimage\fP - \fIimage window\fP, with underflow wrapping
  1268. around (\fImod\fP 256).  The \fBadd\fP and \fBsubtract\fP operators can
  1269. be used to perform reversible transformations.
  1270. .TP 9
  1271. .B difference
  1272. The result of abs(\fIimage\fP \- \fIimage window\fP).  This is useful
  1273. for comparing two very similar images.
  1274. .TP 9
  1275. .B replace
  1276. The resulting image is \fIimage window\fP replaced with \fIimage\fP.
  1277. Here the alpha information is ignored.
  1278. .PP
  1279. The image compositor requires an alpha, or matte channel in the image
  1280. for some operations.  This extra channel usually defines a mask which
  1281. represents a sort of a cookie-cutter for the image.  This is the case
  1282. when alpha is 255 (full coverage) for pixels inside the shape, zero
  1283. outside, and between zero and 255 on the boundary.  If \fIimage\fP does
  1284. not have an alpha channel, it is initialized with 0 for any pixel
  1285. matching in color to pixel location (0,0), otherwise 255.
  1286. .PP
  1287. Note that alpha information for \fIimage window\fP is not retained for
  1288. colormapped X server visuals (e.g. \fIStaticColor\fP,
  1289. \fIStaticColor\fP, \fIGrayScale\fP, \fIPseudoColor\fP).  Correct
  1290. compositing behavior may require a \fITrueColor\fP or \fIDirectColor\fP
  1291. visual or a \fIStandard Colormap\fP.
  1292. .PP
  1293. Choosing a composite operator is optional.  The default operator is
  1294. \Ifover\fP.  However, you must choose a location to composite your image
  1295. and press button 1.  Press and hold button 1 before releasing and an
  1296. outline of the image will appear to help you identify your location.
  1297. .PP
  1298. Immediately after releasing button 1, \fIimage window\fP is
  1299. permanently updated with your composited image.  There is no way to
  1300. `undo' your changes.  Be careful when choosing your location.
  1301. .PP
  1302. The actual colors of the composite image is saved.  However, the color
  1303. that appears in \fIimage window\fP may be different.  For example, on a
  1304. monochrome screen \fIimage window\fP will appear black or white even
  1305. though your composited image may have many colors.  If the image is
  1306. saved to a file it is written with the correct colors.  To assure the
  1307. correct colors are saved in the final image, any \fIPseudoClass\fP
  1308. image is promoted to \fIDirectClass\fP (see \fBMIFF(5)\fP).  To force a
  1309. \fIPseudoClass\fP image to remain \fIPseudoClass\fP, use \fB-colors\fP.
  1310. .SH ENVIRONMENT
  1311. .TP 5
  1312. .B DISPLAY
  1313. To get the default host, display number, and screen.
  1314. .SH SEE ALSO
  1315. import(1), mogrify(1), convert(1), Quantize(9), MIFF(5), X(1), xstdcmap(1),
  1316. more(1), compress(1),
  1317. .SH COPYRIGHT
  1318. Copyright 1992 E. I. du Pont de Nemours & Company
  1319. .PP
  1320. Permission to use, copy, modify, distribute, and sell this software and
  1321. its documentation for any purpose is hereby granted without fee,
  1322. provided that the above copyright notice appear in all copies and that
  1323. both that copyright notice and this permission notice appear in
  1324. supporting documentation, and that the name of E. I. du Pont de Nemours
  1325. & Company not be used in advertising or publicity pertaining to
  1326. distribution of the software without specific, written prior
  1327. permission.  E. I. du Pont de Nemours & Company makes no representations
  1328. about the suitability of this software for any purpose.  It is provided
  1329. "as is" without express or implied warranty.
  1330. .PP
  1331. E. I. du Pont de Nemours & Company disclaims all warranties with regard
  1332. to this software, including all implied warranties of merchantability
  1333. and fitness, in no event shall E. I. du Pont de Nemours & Company be
  1334. liable for any special, indirect or consequential damages or any
  1335. damages whatsoever resulting from loss of use, data or profits, whether
  1336. in an action of contract, negligence or other tortious action, arising
  1337. out of or in connection with the use or performance of this software.
  1338. .SH ACKNOWLEDGEMENTS
  1339. The MIT X Consortium for making network transparent graphics a reality.
  1340. .PP
  1341. Rod Bogart and John W. Peterson, University of Utah.  Image
  1342. compositing is loosely based on \fIrlecomp\fP of the Utah Raster
  1343. Toolkit.
  1344. .PP
  1345. Michael Halle, Spatial Imaging Group at MIT, for the initial
  1346. implementation of Alan Paeth's image rotation algorithm.
  1347. .PP
  1348. David Pensak, E. I. du Pont de Nemours & Company, for providing a
  1349. computing environment that made this program possible.
  1350. .PP
  1351. Paul Raveling, USC Information Sciences Institute, for the original
  1352. idea of using space subdivision for the color reduction algorithm.
  1353. .SH AUTHORS
  1354. John Cristy, E.I. du Pont de Nemours & Company Incorporated
  1355. SHAR_EOF
  1356. chmod 0644 ImageMagick/display.man ||
  1357. echo 'restore of ImageMagick/display.man failed'
  1358. Wc_c="`wc -c < 'ImageMagick/display.man'`"
  1359. test 30521 -eq "$Wc_c" ||
  1360.     echo 'ImageMagick/display.man: original size 30521, current size' "$Wc_c"
  1361. rm -f _shar_wnt_.tmp
  1362. fi
  1363. # ============= ImageMagick/xtp/Makefile ==============
  1364. if test ! -d 'ImageMagick/xtp'; then
  1365.     echo 'x - creating directory ImageMagick/xtp'
  1366.     mkdir 'ImageMagick/xtp'
  1367. fi
  1368. if test -f 'ImageMagick/xtp/Makefile' -a X"$1" != X"-c"; then
  1369.     echo 'x - skipping ImageMagick/xtp/Makefile (File already exists)'
  1370.     rm -f _shar_wnt_.tmp
  1371. else
  1372. > _shar_wnt_.tmp
  1373. echo 'x - extracting ImageMagick/xtp/Makefile (Text)'
  1374. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/xtp/Makefile' &&
  1375. #
  1376. #  Generic makefile for display, animate, montage, XtoPS, and import for
  1377. #  computers that do not have xmkmf.
  1378. #
  1379. #  Copyright 1992 E. I. du Pont de Nemours & Company
  1380. #
  1381. #  Permission to use, copy, modify, distribute, and sell this software and
  1382. #  its documentation for any purpose is hereby granted without fee,
  1383. #  provided that the above Copyright notice appear in all copies and that
  1384. #  both that Copyright notice and this permission notice appear in
  1385. #  supporting documentation, and that the name of E. I. du Pont de Nemours
  1386. #  & Company not be used in advertising or publicity pertaining to
  1387. #  distribution of the software without specific, written prior
  1388. #  permission.  E. I. du Pont de Nemours & Company makes no representations
  1389. #  about the suitability of this software for any purpose.  It is provided
  1390. #  "as is" without express or implied warranty.
  1391. #
  1392. #  E. I. du Pont de Nemours & Company disclaims all warranties with regard
  1393. #  to this software, including all implied warranties of merchantability
  1394. #  and fitness, in no event shall E. I. du Pont de Nemours & Company be
  1395. #  liable for any special, indirect or consequential damages or any
  1396. #  damages whatsoever resulting from loss of use, data or profits, whether
  1397. #  in an action of contract, negligence or other tortious action, arising
  1398. #  out of or in connection with the use or performance of this software.
  1399. #
  1400. X
  1401. CC= cc -O
  1402. DESTDIR= /usr/local/bin
  1403. INSTALL = install -c
  1404. RM= /bin/rm -f
  1405. #SYS_LIBRARIES= -lnsl
  1406. X
  1407. XXTPObjects= xtp.o network.o regular.o
  1408. X
  1409. PROGRAMS= xtp 
  1410. X
  1411. all: $(PROGRAMS)
  1412. X
  1413. xtp:     $(XTPObjects)
  1414. X    $(RM) $@
  1415. X    $(CC) -o $@ $(XTPObjects) $(SYS_LIBRARIES)
  1416. X
  1417. clean::
  1418. X    $(RM) xtp
  1419. X
  1420. install:: xtp
  1421. X    $(INSTALL) xtp $(DESTDIR)
  1422. X
  1423. clean::
  1424. X    $(RM) *.ln *.bak *.o core errs ,* *~ *.a .emacs_* make.log MakeOut
  1425. SHAR_EOF
  1426. chmod 0644 ImageMagick/xtp/Makefile ||
  1427. echo 'restore of ImageMagick/xtp/Makefile failed'
  1428. Wc_c="`wc -c < 'ImageMagick/xtp/Makefile'`"
  1429. test 1752 -eq "$Wc_c" ||
  1430.     echo 'ImageMagick/xtp/Makefile: original size 1752, current size' "$Wc_c"
  1431. rm -f _shar_wnt_.tmp
  1432. fi
  1433. # ============= ImageMagick/xtp/Imakefile ==============
  1434. if test -f 'ImageMagick/xtp/Imakefile' -a X"$1" != X"-c"; then
  1435.     echo 'x - skipping ImageMagick/xtp/Imakefile (File already exists)'
  1436.     rm -f _shar_wnt_.tmp
  1437. else
  1438. > _shar_wnt_.tmp
  1439. echo 'x - extracting ImageMagick/xtp/Imakefile (Text)'
  1440. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/xtp/Imakefile' &&
  1441. #
  1442. #  Imakefile for xtp.
  1443. #
  1444. #  Copyright 1992 E. I. du Pont de Nemours & Company
  1445. #
  1446. #  Permission to use, copy, modify, distribute, and sell this software and
  1447. #  its documentation for any purpose is hereby granted without fee,
  1448. #  provided that the above Copyright notice appear in all copies and that
  1449. #  both that Copyright notice and this permission notice appear in
  1450. #  supporting documentation, and that the name of E. I. du Pont de Nemours
  1451. #  & Company not be used in advertising or publicity pertaining to
  1452. #  distribution of the software without specific, written prior
  1453. #  permission.  E. I. du Pont de Nemours & Company makes no representations
  1454. #  about the suitability of this software for any purpose.  It is provided
  1455. #  "as is" without express or implied warranty.
  1456. #
  1457. #  E. I. du Pont de Nemours & Company disclaims all warranties with regard
  1458. #  to this software, including all implied warranties of merchantability
  1459. #  and fitness, in no event shall E. I. du Pont de Nemours & Company be
  1460. #  liable for any special, indirect or consequential damages or any
  1461. #  damages whatsoever resulting from loss of use, data or profits, whether
  1462. #  in an action of contract, negligence or other tortious action, arising
  1463. #  out of or in connection with the use or performance of this software.
  1464. #
  1465. X
  1466. #include "../Magick.tmpl"
  1467. X
  1468. XXTPObjects= xtp.o network.o regular.o
  1469. X
  1470. PROGRAMS= xtp
  1471. X
  1472. AllTarget($(PROGRAMS))
  1473. X
  1474. NormalProgramTarget(xtp,$(XTPObjects), , , )
  1475. InstallProgram(xtp,$(LOCALDIR))
  1476. InstallManPage(xtp,$(MANDIR))
  1477. SHAR_EOF
  1478. chmod 0644 ImageMagick/xtp/Imakefile ||
  1479. echo 'restore of ImageMagick/xtp/Imakefile failed'
  1480. Wc_c="`wc -c < 'ImageMagick/xtp/Imakefile'`"
  1481. test 1497 -eq "$Wc_c" ||
  1482.     echo 'ImageMagick/xtp/Imakefile: original size 1497, current size' "$Wc_c"
  1483. rm -f _shar_wnt_.tmp
  1484. fi
  1485. # ============= ImageMagick/xtp/xtp.h ==============
  1486. if test -f 'ImageMagick/xtp/xtp.h' -a X"$1" != X"-c"; then
  1487.     echo 'x - skipping ImageMagick/xtp/xtp.h (File already exists)'
  1488.     rm -f _shar_wnt_.tmp
  1489. else
  1490. > _shar_wnt_.tmp
  1491. echo 'x - extracting ImageMagick/xtp/xtp.h (Text)'
  1492. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/xtp/xtp.h' &&
  1493. /*
  1494. X  Include declarations
  1495. */
  1496. #include <stdio.h>
  1497. #if __STDC__ || defined(sgi) || defined(AIXV3)
  1498. #include <stdlib.h>
  1499. #else
  1500. #ifndef vms
  1501. #include <malloc.h>
  1502. #include <memory.h>
  1503. X
  1504. extern long
  1505. X  strtol(),
  1506. X  time();
  1507. #endif
  1508. #endif
  1509. #include <ctype.h>
  1510. #include <math.h>
  1511. #include <string.h>
  1512. X
  1513. /*
  1514. X  Define declarations for the Display program.
  1515. */
  1516. #if __STDC__ || defined(sgi) || defined(AIXV3)
  1517. #define _Declare(formal_parameters) formal_parameters
  1518. #else
  1519. #define const 
  1520. #define _Declare(formal_parameters) ()
  1521. #endif
  1522. #define False  0
  1523. #define True  1
  1524. #define Warning(message,qualifier)  \
  1525. {  \
  1526. X  (void) fprintf(stderr,"%s: %s",application_name,message);  \
  1527. X  if (qualifier != (char *) NULL)  \
  1528. X    (void) fprintf(stderr," (%s)",qualifier);  \
  1529. X  (void) fprintf(stderr,".\n");  \
  1530. }
  1531. X
  1532. #ifndef lint
  1533. static char 
  1534. X  Version[]="@(#)ImageMagick 2.1 92/10/10 cristy@dupont.com";
  1535. #endif
  1536. SHAR_EOF
  1537. chmod 0644 ImageMagick/xtp/xtp.h ||
  1538. echo 'restore of ImageMagick/xtp/xtp.h failed'
  1539. Wc_c="`wc -c < 'ImageMagick/xtp/xtp.h'`"
  1540. test 861 -eq "$Wc_c" ||
  1541.     echo 'ImageMagick/xtp/xtp.h: original size 861, current size' "$Wc_c"
  1542. rm -f _shar_wnt_.tmp
  1543. fi
  1544. # ============= ImageMagick/xtp/README ==============
  1545. if test -f 'ImageMagick/xtp/README' -a X"$1" != X"-c"; then
  1546.     echo 'x - skipping ImageMagick/xtp/README (File already exists)'
  1547.     rm -f _shar_wnt_.tmp
  1548. else
  1549. > _shar_wnt_.tmp
  1550. echo 'x - extracting ImageMagick/xtp/README (Text)'
  1551. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/xtp/README' &&
  1552. XXtp is a utility for retrieving, listing, or printing files from a
  1553. remote network site.  Xtp performs most of the same functions as the
  1554. ftp program, but does not require any interactive commands.  You simply
  1555. specify the file transfer task on the command line and xtp performs the
  1556. transfer automatically.
  1557. X
  1558. To retrieve file contrib/ImageMagick.tar.Z from host export.lcs.mit.edu, 
  1559. use:
  1560. X
  1561. X  xtp -binary -retrieve ImageMagick.tar.Z export.lcs.mit.edu contrib
  1562. X
  1563. XXtp requires 4.3 BSD compatibilities.  I have successfully executed it on
  1564. a SUN, DEC Ultrix, MIPS, IBM RS/6000, and Ardent Titan.
  1565. X
  1566. The author is cristy@dupont.com.  Comments, suggestions, etc, are
  1567. welcome, but be kind.
  1568. X
  1569. ---
  1570. X
  1571. Copyright 1990 E. I. Dupont de Nemours & Company
  1572. X
  1573. Permission to use, copy, modify, distribute, and sell this software and
  1574. its documentation for any purpose is hereby granted without fee,
  1575. provided that the above copyright notice appear in all copies and that
  1576. both that copyright notice and this permission notice appear in
  1577. supporting documentation, and that the name of E. I. Dupont de Nemours
  1578. & Company not be used in advertising or publicity pertaining to
  1579. distribution of the software without specific, written prior
  1580. permission.  E. I. Dupont de Nemours & Company makes no representations
  1581. about the suitability of this software for any purpose.  It is provided
  1582. "as is" without express or implied warranty.
  1583. X
  1584. E. I. Dupont de Nemours & Company disclaims all warranties with regard
  1585. to this software, including all implied warranties of merchantability
  1586. and fitness, in no event shall E. I. Dupont de Nemours & Company be
  1587. liable for any special, indirect or consequential damages or any
  1588. damages whatsoever resulting from loss of use, data or profits, whether
  1589. in an action of contract, negligence or other tortious action, arising
  1590. out of or in connection with the use or performance of this software.
  1591. X
  1592. SHAR_EOF
  1593. chmod 0644 ImageMagick/xtp/README ||
  1594. echo 'restore of ImageMagick/xtp/README failed'
  1595. Wc_c="`wc -c < 'ImageMagick/xtp/README'`"
  1596. test 1876 -eq "$Wc_c" ||
  1597.     echo 'ImageMagick/xtp/README: original size 1876, current size' "$Wc_c"
  1598. rm -f _shar_wnt_.tmp
  1599. fi
  1600. # ============= ImageMagick/xtp/regular.c ==============
  1601. if test -f 'ImageMagick/xtp/regular.c' -a X"$1" != X"-c"; then
  1602.     echo 'x - skipping ImageMagick/xtp/regular.c (File already exists)'
  1603.     rm -f _shar_wnt_.tmp
  1604. else
  1605. > _shar_wnt_.tmp
  1606. echo 'x - extracting ImageMagick/xtp/regular.c (Text)'
  1607. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/xtp/regular.c' &&
  1608. /*
  1609. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1610. %                                                                             %
  1611. %                                                                             %
  1612. %                                                                             %
  1613. %             RRRR   EEEEE   GGGG  U   U  L       AAA   RRRR                  %
  1614. %             R   R  E      G      U   U  L      A   A  R   R                 %
  1615. %             RRRR   EEE    G  GG  U   U  L      AAAAA  RRRR                  %
  1616. %             R R    E      G   G  U   U  L      A   A  R R                   %
  1617. %             R  R   EEEEE   GGGG   UUU   LLLLL  A   A  R  R                  %
  1618. %                                                                             %
  1619. %                                                                             %
  1620. %                     Regular Expression Interpreter.                         %
  1621. %                                                                             %
  1622. %                                                                             %
  1623. %                                                                             %
  1624. %                           Software Design                                   %
  1625. %                             John Cristy                                     %
  1626. %                              July 1992                                      %
  1627. %                                                                             %
  1628. %                                                                             %
  1629. %  Copyright 1992 E. I. Dupont de Nemours & Company                           %
  1630. %                                                                             %
  1631. %  Permission to use, copy, modify, distribute, and sell this software and    %
  1632. %  its documentation for any purpose is hereby granted without fee,           %
  1633. %  provided that the above Copyright notice appear in all copies and that     %
  1634. %  both that Copyright notice and this permission notice appear in            %
  1635. %  supporting documentation, and that the name of E. I. Dupont de Nemours     %
  1636. SHAR_EOF
  1637. true || echo 'restore of ImageMagick/xtp/regular.c failed'
  1638. fi
  1639. echo 'End of  part 2'
  1640. echo 'File ImageMagick/xtp/regular.c is continued in part 3'
  1641. echo 3 > _shar_seq_.tmp
  1642. exit 0
  1643. exit 0 # Just in case...
  1644.