home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-07-13 | 50.3 KB | 1,379 lines |
- Newsgroups: comp.sources.x
- From: cristy@eplrx7.es.duPont.com (Cristy)
- Subject: v20i082: imagemagic - X11 image processing and display, Part26/38
- Message-ID: <1993Jul14.232021.22484@sparky.sterling.com>
- X-Md4-Signature: f0aba1f876e750cb7ce60922247dac9b
- Sender: chris@sparky.sterling.com (Chris Olson)
- Organization: Sterling Software
- Date: Wed, 14 Jul 1993 23:20:21 GMT
- Approved: chris@sterling.com
-
- Submitted-by: cristy@eplrx7.es.duPont.com (Cristy)
- Posting-number: Volume 20, Issue 82
- Archive-name: imagemagic/part26
- Environment: X11
- Supersedes: imagemagic: Volume 13, Issue 17-37
-
- #!/bin/sh
- # this is magick.26 (part 26 of ImageMagick)
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file ImageMagick/display.man continued
- #
- if test ! -r _shar_seq_.tmp; then
- echo 'Please unpack part 1 first!'
- exit 1
- fi
- (read Scheck
- if test "$Scheck" != 26; then
- echo Please unpack part "$Scheck" next!
- exit 1
- else
- exit 0
- fi
- ) < _shar_seq_.tmp || exit 1
- if test ! -f _shar_wnt_.tmp; then
- echo 'x - still skipping ImageMagick/display.man'
- else
- echo 'x - continuing file ImageMagick/display.man'
- sed 's/^X//' << 'SHAR_EOF' >> 'ImageMagick/display.man' &&
- to take effect.
- .TP 5
- .B "-compress \fItype\fP"
- the type of image compression: \fIQEncoded\fP or \fIRunlengthEncoded\fP.
- X
- Use this option with \fB-write\fP to specify the the type of image
- compression. See \fBmiff(5)\fP for details.
- X
- Specify \fB\+compress\fP to store the binary image in an uncompressed format.
- The default is the compression type of the specified image file.
- .TP 5
- .B "-delay \fIseconds\fP"
- display the next image after pausing.
- X
- This option is useful when viewing several images in sequence. Each
- image will display and wait the number of seconds specified before the
- next image is displayed. The default is to display the image
- and wait until you choose to display the next image or terminate the
- program.
- .TP 5
- .B "-density \fI<width>x<height>
- vertical and horizonal density of the image.
- X
- This option specifies an image density whose interpretation changes
- with the type of image. The default is 72 dots per inch in the
- horizonal and vertical direction for Postscript. Text files default to
- 80 characters in width and 60 lines in height. Use this option to
- alter the default density.
- .TP 5
- .B "-display \fIhost:display[.screen]\fP"
- specifies the X server to contact; see \fBX(1)\fP.
- .TP 5
- .B "-dither"
- apply Floyd/Steinberg error diffusion to the image.
- X
- The basic strategy of dithering is to trade intensity resolution for
- spatial resolution by averaging the intensities of several neighboring
- pixels. Images which suffer from severe contouring when reducing colors
- can be improved with this option.
- X
- The \fB-colors\fP or \fB-monochrome\fP option is required
- for this option to take effect.
- .TP 5
- .B "-enhance"
- apply a digital filter to enhance a noisy image.
- .TP 5
- .B "-gamma \fIvalue\fP"
- level of gamma correction.
- X
- The same color image displayed on two different workstations may look
- different due to differences in the display monitor. Use gamma
- correction to adjust for this color difference. Reasonable values
- extend from 0.8 to 2.3.
- .TP 5
- .B "-geometry \fI<width>x<height>{\+-}<x offset>{\+-}<y offset>\fP"
- preferred size and location of the image window. See \fBX(1)\fP for details
- about the geometry specification. By default, the window size is the image
- size and the location is choosen by you when it is mapped.
- X
- If the specified image size is smaller than the actual image size, the
- image is first reduced to an integral of the specified image size with
- an antialias digital filter. The image is then scaled to the exact
- specified image size with pixel replication. If the specified image
- size is greater than the actual image size, the image is first enlarged
- to an integral of the specified image size with bilinear
- interpolation. The image is then scaled to the exact specified image
- size with pixel replication.
- X
- When displaying an image on an X server, \fI<x offset>\fP and
- \fI<y offset>\fP is relative to the root window.
- X
- The equivalent X resource for this option is \fBimageGeometry\fP
- (class \fBImageGeometry\fP). See \fBX RESOURCES\fP for details.
- .TP 5
- .B "-interlace \fItype\fP"
- the type of interlacing scheme: \fBNONE\fP, \fBLINE\fP, or \fBPLANE\fP.
- X
- This option is used to specify the type of interlacing scheme for raw
- image formats such as \fBRGB\fP or \fBYUV\fP. \fBNONE\fP means do not
- interlace (RGBRGBRGBRGBRGBRGB...), \fBLINE\fP uses scanline
- interlacing (RRR...GGG...BBB...RRR...GGG...BBB...), and \fBPLANE\fP uses
- plane interlacing (RRRRRR...GGGGGG...BBBBBB...).
- .TP 5
- .B "-inverse"
- apply color inversion to image.
- X
- The red, green, and blue intensities of an image are negated.
- .TP 5
- .B "-map \fItype\fP"
- display image using this Standard Colormap type.
- X
- Choose from these Standard Colormap types:
- X
- X default
- X best
- X red
- X green
- X blue
- X gray
- X
- The X server must support the Standard Colormap you choose, otherwise an
- error occurs. See \fBxstdcmap(1)\fP for one way of creating Standard
- Colormaps.
- .TP 5
- .B "-monochrome"
- transform the image to black and white.
- X
- Monochrome images can benefit from error diffusion. Use \fB-dither\fP with
- this option to diffuse the error.
- .TP 5
- .B "-noise"
- reduce the noise in an image with a noise peak elimination filter.
- X
- The principal function of noise peak elimination filter is to smooth
- the objects within an image without losing edge information and without
- creating undesired structures. The central idea of the algorithm is to
- replace a pixel with its next neighbor in value within a 3 x 3 window,
- if this pixel has been found to be noise. A pixel is defined as noise
- if and only if this pixel is a maximum or minimum within the 3 x 3 window.
- .TP 5
- .B "-normalize"
- tranform image to span the full range of color values.
- X
- This is a contrast enhancement technique.
- .TP 5
- .B "-page \fI<width>x<height>{\+-}<x offset>{\+-}<y offset>\fP"
- size and location of the Postscript page.
- X
- Use this option to specify the dimensions of the Postscript page in picas. The
- default is to center the image on a letter page, 612 by 792 dots per inch.
- Other common sizes are:
- X
- X 540x720 Note
- X 612x1008 Legal
- X 842x1190 A3
- X 595x842 A4
- X 421x595 A5
- X 297x421 A6
- X 709x1002 B4
- X 612x936 U.S. Foolscap
- X 612x936 European Foolscap
- X 396x612 Half Letter
- X 792x1224 11x17
- X 1224x792 Ledger
- X
- The page geometry is relative to the vertical and horizonal density of the
- Postscript page. See \fB-density\fP for details.
- .TP 5
- .B "-quality \fIvalue\fP"
- JPEG quality setting.
- X
- Quality is 0 (worst) to 100 (best). The default is 75.
- .TP 5
- .B "-reflect"
- create a "mirror image" by reflecting the image scanlines.
- .TP 5
- .B "-rotate \fIdegrees\fP"
- apply Paeth image rotation to the image.
- X
- Empty triangles left over from rotating the image are filled with
- the color defined by the pixel at location (0,0).
- .TP 5
- .B "-scale \fI<width factor>x<height factor>\fP"
- preferred size factors of the image.
- X
- This option behaves like \fB-geometry\fP except the width and height values
- are relative instead of absolute. The image size is multiplied by the
- width and height factors to obtain the final image dimensions. If only
- one factor is specified, both the width and height factors assume the
- value.
- X
- Factors may be fractional. To increase the size of an image, use a
- scale factor greater than 1.0. To decrease an image's size, use a
- scale factor less than 1.0. Default is 1.0.
- X
- The equivalent X resource for this option is \fBscaleGeometry\fP
- (class \fBScaleGeometry\fP). See \fBX RESOURCES\fP for details.
- .TP 5
- .B "-scene \fIvalue\fP"
- image scene number.
- .TP 5
- .B "-treedepth \fIvalue\fP"
- Normally, this integer value is zero or one. A zero or one tells
- \fBdisplay\fP to choose a optimal tree depth for the color reduction
- algorithm.
- X
- An optimal depth generally allows the best representation of the source
- image with the fastest computational speed and the least amount of
- memory. However, the default depth is inappropriate for some images.
- To assure the best representation, try values between 2 and 8 for this
- parameter. Refer to \fBquantize(9)\fP for more details.
- X
- The \fB-colors\fP or \fB-monochrome\fP option is required
- for this option to take effect.
- .TP 5
- .B "-update \fIseconds\fP"
- detect when image file is modified and redisplay.
- X
- Suppose that while you are displaying an image the file that is
- currently displayed is over-written. \fBdisplay\fP will automatically
- detect that the input file has been changed and update the displayed
- image accordingly.
- .TP 5
- .B -verbose
- print detailed information about the image.
- X
- This information is printed: image scene number; image name; image
- size; the image class (\fIDirectClass\fP or \fIPseudoClass\fP); the total
- number of unique colors; and the number of seconds to read and
- transform the image. Refer to \fBmiff(5)\fP for a description of
- the image class.
- X
- If \fB-colors\fP is also specified, the total unique colors in the image
- and color reduction error values are printed. Refer to \fBquantize(9)\fP
- for a description of these values.
- .TP 5
- .B "-visual \fItype\fP"
- display image using this visual type.
- X
- Choose from these visual classes:
- X
- X StaticGray
- X GrayScale
- X StaticColor
- X PseudoColor
- X TrueColor
- X DirectColor
- X default
- X \fIvisual id\fP
- X
- The X server must support the visual you choose, otherwise an error occurs.
- If a visual is not specified, the visual class that can display the most
- simultaneous colors on the default X server screen is choosen.
- .TP 5
- .B "-window \fIid\fP"
- set the background pixmap of this window to the image.
- X
- \fIid\fP can be a window id or name. Specify \fBroot\fP to select X's root
- window as the target window.
- X
- By default the image is tiled onto the background of the target
- window. If \fB-backdrop\fP or \fB-geometry\fP are specified, the
- image is surrounded by the background color. Refer to \fBX
- RESOURCES\fP for details.
- X
- The image will not display on the root window if the image has more
- unique colors than the target window colormap allows. Use
- \fB-colors\fP to reduce the number of colors.
- .TP 5
- .B "-write \fIfilename\fP"
- write image to a file.
- X
- If \fIfile\fP already exists, you will be prompted as to whether
- it should be overwritten.
- X
- If the image format is MIFF and the number of unique colors in the image
- exceeds 4096, it is stored as \fIDirectClass\fP; otherwise, it is
- stored as \fIPseudoClass\fP format. Refer to \fBmiff(5)\fP for more
- details.
- X
- By default, the image is written in the format that it was read in as.
- To specify a particular image format, prefix \fIfile\fP with the image
- type and a colon (i.e. ps:image) or specify the image type as the
- filename suffix (i.e. image.ps). See \fBconvert(1)\fP for a list of
- valid image formats. If \fIfile\fP has the extension \fB.Z\fP or
- \fB.gz\fP, the file size is compressed using with \fBcompress\fP
- or \fBgzip\fP respectively. If \fIfile\fP already exists, you will be
- prompted as to whether it should be overwritten.
- X
- Use \fB-compress\fP to specify the type of image compression.
- X
- The equivalent X resource for this option is \fBwriteFilename\fP
- (class \fBWriteFilename\fP). See \fBX RESOURCES\fP for details.
- .PP
- In addition to those listed above, you can specify these standard X
- resources as command line options: \fB-background\fP,
- \fB-bordercolor\fP, \fB-borderwidth\fP, \fB-font\fP,
- \fB-foreground\fP, \fB-iconGeometry\fP, \fB-iconic\fP, \fB-name\fP, or
- \fB-title\fP. See \fBX RESOURCES\fP for details.
- .PP
- Any option you specify on the command line remains in effect until it is
- explicitly changed by specifying the option again with a different effect.
- For example to display two images, the first with 32 colors, and the
- second with only 16 colors, use:
- .PP
- X display -colors 32 cockatoo.miff -colors 16 macaw.miff
- .PP
- Change \fI-\fP to \fI\+\fP in any option above to reverse its effect.
- For example, specify \fB\+compress\fP to store the binary image in an
- uncompressed format.
- .PP
- By default, the image format is determined by its magic number. To
- specify a particular image format, precede the filename with an image
- format name and a colon (i.e. ps:image) or specify the image type as
- the filename suffix (i.e. image.ps). See \fBconvert(1)\fP for a list
- of valid image formats.
- .PP
- When you specify \fBX\fP as your image type, the filename has special
- meaning. It specifies an X window by id, name, or \fBroot\fP. If no
- filename is specified, the window is selected by clicking the mouse in
- the desired window.
- .PP
- Specify \fIfile\fP as \fI-\fP for standard input. If \fIfile\fP has
- the extension \fB.Z\fP or \fB.gz\fP, the file is uncompressed with
- \fBuncompress\fP or \fBgunzip\fP respectively.
- .SH BUTTONS
- The effects of each button press is described below. Three buttons are
- required. If you have a two button mouse, button 1 and 3 are returned.
- Press ALT and button 3 to simulate button 2.
- .TP 5
- .B "1"
- Press and drag to select a command from a pop-up menu. Choose from
- these commands:
- X
- X Image Info
- X Reflect
- X Rotate Right
- X Rotate Left
- X Half Size
- X Double Size
- X Restore
- X Annotate
- X Composite
- X Load
- X Write
- X Next
- X Previous
- X Quit
- .TP 5
- .B "2"
- Press and drag to define a region of the image to clip. Release the button
- to crop the image, or return the pointer to the location of the initial button
- press to cancel the cropping operation.
- .TP 5
- .B "3"
- Press and drag to define a region of the image to magnify.
- X
- Note, this button behaves differently for a composite MIFF image
- created with \fBmontage\fP. Choose a particular tile of the composite
- and press this button, the image represented by the tile is then
- displayed. To return to the composite MIFF image, choose \fINext\fP
- from the command menu (refer to Button 1). See \fBmontage(1)\fP and
- \fBmiff(5)\fP for more details.
- X
- .SH KEYBOARD ACCELERATORS
- .TP 5
- .B "i"
- Press to display information about the image. Press any key or button to
- erase the information.
- X
- This information is printed: image scene number; image name; image
- size; the visual class (see \fB-visual\fP); and the total number of
- unique colors in the image.
- .TP 5
- .B "r"
- Press to reflect the image scanlines.
- .TP 5
- .B "/"
- Press to rotate the image 90 degrees clockwise.
- .TP 5
- .B "\e"
- Press to rotate the image 90 degrees counter-clockwise.
- .TP 5
- .B "<"
- Press to half the image size.
- .TP 5
- .B ">"
- Press to double the image size.
- .TP 5
- .B "o"
- Press to restore the image to its original size.
- .TP 5
- .B "a"
- Press to annotate the image with text.
- X
- Refer to \fBIMAGE ANNOTATION\fP for more details.
- .TP 5
- .B "c"
- Press to composite the image with another.
- X
- Refer to \fBIMAGE COMPOSITING\fP for more details.
- .TP 5
- .B "l"
- Press to load an image from a file.
- .TP 5
- .B "w"
- Press to write the image to a file.
- .TP 5
- .B "n"
- Press to display the next image.
- .TP 5
- .B "p"
- Press to display the previous image.
- .TP 5
- .B "q"
- Press to discard all images and exit program.
- .TP 5
- .B "1-9"
- Press to change the level of magnification.
- X
- Use the arrow keys to move the image one pixel up, down, left, or right within
- the magnify window. Be sure to first map the magnify window by pressing
- button 3.
- X
- Press \fB<ctrl>\fP and one of the arrow keys to trim off one pixel from
- any side of the image. You can closely define the area of the image
- you want to crop with button 2. Use the trimming keys for a more
- precise measurement.
- .SH "X RESOURCES"
- \fBdisplay\fP options can appear on the command line or in your X
- resource file. Options on the command line supersede values specified
- in your X resource file. See \fBX(1)\fP for more information on X
- resources.
- X
- All \fBdisplay\fP options have a corresponding X resource. In addition,
- \fBdisplay\fP uses the following X resources:
- .TP 5
- .B background (\fPclass\fB Background)
- Specifies the preferred color to use for the image window background. The
- default is black.
- .TP 5
- .B borderColor (\fPclass\fB BorderColor)
- Specifies the preferred color to use for the image window border. The
- default is white.
- .TP 5
- .B borderWidth (\fPclass\fB BorderWidth)
- Specifies the width in pixels of the image window border. The default is 2.
- .TP 5
- .B font (\fPclass\fB Font)
- Specifies the name of the preferred font to use when displaying text
- within the image window. The default is \fI9x15\fP, \fIfixed\fP, or
- \fI6x13\fP determined by the image window size.
- .TP 5
- .B font[1-9] (\fPclass\fB Font[1-9])
- Specifies the name of the preferred font to use when annotating the
- image window with text. The default fonts are \fIfixed\fP,
- \fIvariable\fP, \fI5x8\fP, \fI6x10\fP, \fI7x13bold\fP, \fI8x13bold\fP,
- \fI9x15bold\fP, \fI10x20\fP, and \fI12x24\fP. Refer to \fBIMAGE
- ANNOTATION\fP for more details.
- .TP 5
- .B foreground (\fPclass\fB Foreground)
- Specifies the preferred color to use for text within the image window. The
- default is white.
- .TP 5
- .B iconGeometry (\fPclass\fB IconGeometry)
- Specifies the preferred size and position of the application when
- iconified. It is not necessarily obeyed by all window managers.
- .TP 5
- .B iconic (\fPclass\fB Iconic)
- This resource indicates that you would prefer that the application's
- windows initially not be visible as if the windows had be immediately
- iconified by you. Window managers may choose not to honor the
- application's request.
- .TP 5
- .B magnify (\fPclass\fB Magnify)
- specifies an integral factor by which the image should be enlarged. The
- default is 2.
- X
- This value only affects the magnification window which is invoked with
- button number 3 after the image is displayed. Refer to \fBBUTTONS\fP
- for more details.
- .TP 5
- .B name (\fPclass\fB Name)
- This resource specifies the name under which resources for the
- application should be found. This resource is useful in shell aliases to
- distinguish between invocations of an application, without resorting to
- creating links to alter the executable file name. The default is the
- application name.
- .TP 5
- .B pen[1-9] (\fPclass\fB Pen[1-9])
- Specifies the color of the preferred font to use when annotating the
- image window with text. The default colors are \fIblack\fP,
- \fIblue\fP, \fIgreen\fP, \fIcyan\fP, \fIgray\fP, \fIred\fP,
- \fImagenta\fP, \fIyellow\fP, and \fIwhite\fP. Refer to \fBIMAGE
- ANNOTATION\fP for more details.
- .TP 5
- .B title (\fPclass\fB Title)
- This resource specifies the title to be used for the image window. This
- information is sometimes used by a window manager to provide a
- header identifying the window. The default is the image file name.
- .TP 5
- .B usePixmap (\fPclass\fB UsePixmap)
- Images are maintained as a XImage by default. Set this resource to True
- to utilize a server Pixmap instead. This option is useful if your image
- exceeds the dimensions of your server screen and you intend to pan the
- image. The panning is much faster with Pixmaps than with a XImage.
- Pixmaps are considered a precious resource, use them with discretion.
- .SH IMAGE PANNING
- When an image exceeds the width or height of the X server screen,
- \fBdisplay\fP maps a small panning window. The rectangle within the
- panning window shows the area that is currently displayed in the
- the image window. To "pan" about the image, press and drag the mouse
- within the panning window. The panning rectangle moves with the mouse
- and the image window is updated to reflect the location of the
- rectangle within the panning window. When you have selected the area
- of the image you wish to view, just release the mouse button.
- X
- Use the arrow keys to pan the image one pixel up, down, left, or right within
- the image window.
- X
- The panning window goes away if the image becomes smaller than the
- dimensions of the X server screen.
- .SH IMAGE ANNOTATION
- An image is annotated with text interactively. There is no command
- line argument to annotate an image. To begin, press button 1 and
- choose \fIAnnotate Image\fP from the command menu (see \fBBUTTONS\fP).
- Alternatively, press \fIa\fP in the image window (see \fBKEYBOARD
- ACCELERATORS\fP). To exit immediately, press \fIESC\fP.
- .PP
- A small window appears showing the location of the cursor in the image
- window. You are now in \fIannotate mode\fP. To exit immediately,
- press \fIESC\fP. In \fIannotate mode\fP a button press has a different
- effect than described in \fBBUTTONS\fP. Press a button to affect this
- behavior:
- .TP 5
- .B "1"
- Press to select a location within the image window to begin entering text.
- .TP 5
- .B "2"
- Press and drag to select a font from a pop-up menu. Choose from
- these fonts:
- X
- X fixed
- X variable
- X 5x8
- X 6x10
- X 7x13bold
- X 8x13bold
- X 9x15bold
- X 10x20
- X 12x24
- X
- Other fonts can be specified by setting the X resources \fBfont1\fP through
- \fBfont9\fP. Refer to \fBX RESOURCES\fP for more details.
- .TP 5
- .B "3"
- Press and drag to select a font color from a pop-up menu. Choose from
- these font colors:
- X
- X black
- X blue
- X cyan
- X green
- X gray
- X red
- X magenta
- X yellow
- X white
- X
- Other font colors can be specified by setting the X resources \fBpen1\fP
- through \fBpen9\fP. Refer to \fBX RESOURCES\fP for more details.
- .PP
- Choosing a font and its color is optional. The default font is
- \fIfixed\fP and the default color is \fIblack\fP. However, you must
- choose a location to begin entering text and press button 1. An
- underscore character will appear at the location of the cursor where
- you pressed button 1. The cursor changes to a pencil to indicate
- you are in \fItext mode\fP. To exit immediately, press \fIESC\fP.
- .PP
- In \fItext mode\fP, any key presses will display the character at
- the location of the underscore and advance the underscore cursor.
- Enter your text and once completed press \fIESC\fP to finish your image
- annotation. To correct errors press \fIBACK SPACE\fP. To delete an
- entire line of text, press \fIDELETE\fP. Any text that exceeds the
- boundaries of the image window is automatically continued onto the next
- line.
- .PP
- Before exiting \fItext mode\fP, immediately after pressing the
- \fIESC\fP key, the image is permanently updated with the text you
- entered. There is no way to `undo' your changes so be careful to
- check your text before you press \fIESC\fP.
- .PP
- The actual color you request for the font is saved in the image.
- However, the color that appears in your image window may be different.
- For example, on a monochrome screen the text will appear black or white even
- if you choose the color red as the font color. However, the image saved to
- a file with \fB-write\fP will be written with red lettering. To assure
- the correct color text in the final image, any \fIPseudoClass\fP image
- is promoted to \fIDirectClass\fP (see \fBmiff(5)\fP). To
- force a \fIPseudoClass\fP image to remain \fIPseudoClass\fP, use
- \fB-colors\fP.
- .SH IMAGE COMPOSITING
- An image composite is created interactively. There is no command line
- argument to composite an image. To begin, press button 1 and choose
- \fIComposite Image\fP from the command menu (see \fBBUTTONS\fP).
- Alternatively, press \fIc\fP in the image window (see \fBKEYBOARD
- ACCELERATORS\fP).
- .PP
- First a popup window is displayed requesting you to enter an image name.
- Press \fIRETURN\fP, enter 'X:', or type a file name. Press \fIRETURN\fP if
- you choose not to create a composite image. When you specify \fBX:\fP
- as your file name, the filename has special meaning. It specifies an X
- window by id, name, or \fBroot\fP. If no filename is specified, the
- window is selected by clicking the mouse in the desired window. See
- \fBimport(1)\fP for details.
- .PP
- A small window appears showing the location of the cursor in the image
- window. You are now in \fIcomposite mode\fP. To exit immediately,
- press \fIESC\fP. In \fIcomposite mode\fP a button press has a
- different effect than described in \fBBUTTONS\fP. Press a button to
- affect this behavior:
- .TP 5
- .B "1"
- Press to select a location within \fIimage window\fP to composite your
- image.
- .TP 5
- .B "2"
- Press and drag to select a composite operation from a pop-up menu.
- Choose from these composite operations:
- X
- X over
- X in
- X out
- X atop
- X xor
- X plus
- X minus
- X add
- X subtract
- X difference
- X replace
- .PP
- The operations behaves as follows:
- .TP 9
- .B over
- The result will be the union of the two image shapes, with \fIimage\fP
- obscuring \fIimage window\fP in the region of overlap.
- .TP 9
- .B in
- The result is simply \fIimage\fP cut by the shape of \fIimage
- window\fP. None of the image data of \fIimage window\fP will be in the
- result.
- .TP 9
- .B out
- The resulting image is \fIimage\fP with the shape of \fIimage window\fP
- cut out.
- .TP 9
- .B atop
- The result is the same shape as image \fIimage window\fP, with
- \fIimage\fP obscuring \fIimage window\fP where the image shapes
- overlap. Note this differs from \fBover\fP because the portion of
- \fIimage\fP outside \fIimage window\fP's shape does not appear in the
- result.
- .TP 9
- .B xor
- The result is the image data from both \fIimage\fP and \fIimage window\fP
- that is outside the overlap region. The overlap region will be blank.
- .TP 9
- .B plus
- The result is just the sum of the image data. Output values are
- clipped to 255 (no overflow). This operation is independent
- of the alpha channels.
- .TP 9
- .B minus
- The result of \fIimage\fP \- \fIimage window\fP, with underflow clipped
- to zero. The alpha channel is ignored (set to 255, full coverage).
- .TP 9
- .B add
- The result of \fIimage\fP + \fIimage window\fP, with overflow wrapping
- around (\fImod\fP 256).
- .TP 9
- .B subtract
- The result of \fIimage\fP - \fIimage window\fP, with underflow wrapping
- around (\fImod\fP 256). The \fBadd\fP and \fBsubtract\fP operators can
- be used to perform reversible transformations.
- .TP 9
- .B difference
- The result of abs(\fIimage\fP \- \fIimage window\fP). This is useful
- for comparing two very similar images.
- .TP 9
- .B replace
- The resulting image is \fIimage window\fP replaced with \fIimage\fP.
- Here the alpha information is ignored.
- .PP
- The image compositor requires an alpha, or matte channel in the image
- for some operations. This extra channel usually defines a mask which
- represents a sort of a cookie-cutter for the image. This is the case
- when alpha is 255 (full coverage) for pixels inside the shape, zero
- outside, and between zero and 255 on the boundary. If \fIimage\fP does
- not have an alpha channel, it is initialized with 0 for any pixel
- matching in color to pixel location (0,0), otherwise 255.
- .PP
- Note that alpha information for \fIimage window\fP is not retained for
- colormapped X server visuals (e.g. \fIStaticColor\fP,
- \fIStaticColor\fP, \fIGrayScale\fP, \fIPseudoColor\fP). Correct
- compositing behavior may require a \fITrueColor\fP or \fIDirectColor\fP
- visual or a \fIStandard Colormap\fP.
- .PP
- Choosing a composite operator is optional. The default operator is
- \fIover\fP. However, you must choose a location to composite your image
- and press button 1. Press and hold button 1 before releasing and an
- outline of the image will appear to help you identify your location.
- .PP
- Immediately after releasing button 1, \fIimage window\fP is
- permanently updated with your composited image. There is no way to
- `undo' your changes. Be careful when choosing your location.
- .PP
- The actual colors of the composite image is saved. However, the color
- that appears in \fIimage window\fP may be different. For example, on a
- monochrome screen \fIimage window\fP will appear black or white even
- though your composited image may have many colors. If the image is
- saved to a file it is written with the correct colors. To assure the
- correct colors are saved in the final image, any \fIPseudoClass\fP
- image is promoted to \fIDirectClass\fP (see \fBmiff(5)\fP). To force a
- \fIPseudoClass\fP image to remain \fIPseudoClass\fP, use \fB-colors\fP.
- .SH ENVIRONMENT
- .TP 5
- .B display
- To get the default host, display number, and screen.
- .SH SEE ALSO
- .B
- import(1), mogrify(1), convert(1), quantize(9), miff(5), X(1), xstdcmap(1), more(1), compress(1)
- .SH COPYRIGHT
- Copyright 1993 E. I. du Pont de Nemours & Company
- .PP
- Permission to use, copy, modify, distribute, and sell this software and
- its documentation for any purpose is hereby granted without fee,
- provided that the above copyright notice appear in all copies and that
- both that copyright notice and this permission notice appear in
- supporting documentation, and that the name of E. I. du Pont de Nemours
- & Company not be used in advertising or publicity pertaining to
- distribution of the software without specific, written prior
- permission. E. I. du Pont de Nemours & Company makes no representations
- about the suitability of this software for any purpose. It is provided
- "as is" without express or implied warranty.
- .PP
- E. I. du Pont de Nemours & Company disclaims all warranties with regard
- to this software, including all implied warranties of merchantability
- and fitness, in no event shall E. I. du Pont de Nemours & Company be
- liable for any special, indirect or consequential damages or any
- damages whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action, arising
- out of or in connection with the use or performance of this software.
- .SH ACKNOWLEDGEMENTS
- The MIT X Consortium for making network transparent graphics a reality.
- .PP
- Rod Bogart and John W. Peterson, University of Utah. Image
- compositing is loosely based on \fIrlecomp\fP of the Utah Raster
- Toolkit.
- .PP
- Michael Halle, Spatial Imaging Group at MIT, for the initial
- implementation of Alan Paeth's image rotation algorithm.
- .PP
- David Pensak, E. I. du Pont de Nemours & Company, for providing a
- computing environment that made this program possible.
- .PP
- Paul Raveling, USC Information Sciences Institute, for the original
- idea of using space subdivision for the color reduction algorithm.
- .SH AUTHORS
- John Cristy, E.I. du Pont de Nemours & Company Incorporated
- SHAR_EOF
- echo 'File ImageMagick/display.man is complete' &&
- chmod 0644 ImageMagick/display.man ||
- echo 'restore of ImageMagick/display.man failed'
- Wc_c="`wc -c < 'ImageMagick/display.man'`"
- test 32428 -eq "$Wc_c" ||
- echo 'ImageMagick/display.man: original size 32428, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= ImageMagick/import.c ==============
- if test -f 'ImageMagick/import.c' -a X"$1" != X"-c"; then
- echo 'x - skipping ImageMagick/import.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting ImageMagick/import.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/import.c' &&
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % IIIII M M PPPP OOO RRRR TTTTT %
- % I MM MM P P O O R R T %
- % I M M M PPPP O O RRRR T %
- % I M M P O O R R T %
- % IIIII M M P OOO R R T %
- % %
- % %
- % Import X11 image to a machine independent format. %
- % %
- % %
- % %
- % Software Design %
- % John Cristy %
- % July 1992 %
- % %
- % %
- % Copyright 1993 E. I. du Pont de Nemours & Company %
- % %
- % Permission to use, copy, modify, distribute, and sell this software and %
- % its documentation for any purpose is hereby granted without fee, %
- % provided that the above Copyright notice appear in all copies and that %
- % both that Copyright notice and this permission notice appear in %
- % supporting documentation, and that the name of E. I. du Pont de Nemours %
- % & Company not be used in advertising or publicity pertaining to %
- % distribution of the software without specific, written prior %
- % permission. E. I. du Pont de Nemours & Company makes no representations %
- % about the suitability of this software for any purpose. It is provided %
- % "as is" without express or implied warranty. %
- % %
- % E. I. du Pont de Nemours & Company disclaims all warranties with regard %
- % to this software, including all implied warranties of merchantability %
- % and fitness, in no event shall E. I. du Pont de Nemours & Company be %
- % liable for any special, indirect or consequential damages or any %
- % damages whatsoever resulting from loss of use, data or profits, whether %
- % in an action of contract, negligence or other tortious action, arising %
- % out of or in connection with the use or performance of this software. %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % Import is an X Window System window dumping utility. Import allows X
- % users to store window images in a specially formatted dump file. This
- % file can then be read by the Display utility for redisplay, printing,
- % editing, formatting, archiving, image processing, etc. The target
- % window can be specified by id or name or be selected by clicking the
- % mouse in the desired window. The keyboard bell is rung once at the
- % beginning of the dump and twice when the dump is completed.
- %
- % The import program command syntax is:
- %
- % Usage: import [options ...] file
- %
- % Where options include:
- % -border include image borders in the output image
- % -compress type RunlengthEncoded or QEncoded
- % -delay seconds pause before selecting target window
- % -descend obtain image by descending window hierarchy
- % -density geometry vertical and horizonal density of the image
- % -display server X server to contact
- % -frame include window manager frame
- % -geometry geometry preferred size and location of the image
- % -interlace type NONE, LINE, or PLANE
- % -monochrome transform image to black and white
- % -page geometry size and location of the Postscript page
- % -quality value JPEG quality setting
- % -rotate degrees apply Paeth rotation to the image
- % -scene value image scene number
- % -screen select image from root window
- % -verbose print detailed information about the image
- % -window id select window with this id or name
- %
- % Change '-' to '+' in any option above to reverse its effect.
- % For example, +frame means do not window manager frame.
- %
- % By default, 'file' is written in the Postscript image format. To specify
- % a particular image format, precede the filename with an image format
- % name and a colon (i.e. ps:image) or specify the image type as the
- % filename suffix (i.e. image.ps). Specify 'file' as '-' for standard
- % input or output.
- %
- %
- */
- X
- /*
- X Include declarations.
- */
- #include "display.h"
- #include "image.h"
- #include "X.h"
- X
- /*
- X Global declarations.
- */
- char
- X *client_name;
- X
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % E r r o r %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % Function Error displays an error message and then terminates the program.
- %
- % The format of the Error routine is:
- %
- % Error(message,qualifier)
- %
- % A description of each parameter follows:
- %
- % o message: Specifies the message to display before terminating the
- % program.
- %
- % o qualifier: Specifies any qualifier to the message.
- %
- %
- */
- void Error(message,qualifier)
- char
- X *message,
- X *qualifier;
- {
- X (void) fprintf(stderr,"%s: %s",client_name,message);
- X if (qualifier != (char *) NULL)
- X (void) fprintf(stderr," (%s)",qualifier);
- X (void) fprintf(stderr,".\n");
- X exit(1);
- }
- X
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % U s a g e %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % Procedure Usage displays the program usage;
- %
- % The format of the Usage routine is:
- %
- % Usage()
- %
- %
- */
- static void Usage()
- {
- X char
- X **p;
- X
- X static char
- X *options[]=
- X {
- X "-border include image borders in the output image",
- X "-compress type RunlengthEncoded or QEncoded",
- X "-delay seconds pause before selecting target window",
- X "-descend obtain image by descending window hierarchy",
- X "-density geometry vertical and horizonal density of the image",
- X "-display server X server to contact",
- X "-frame include window manager frame",
- X "-geometry geometry preferred size and location of the image",
- X "-interlace type NONE, LINE, or PLANE",
- X "-monochrome transform image to black and white",
- X "-page geometry size and location of the Postscript page",
- X "-quality value JPEG quality setting",
- X "-rotate degrees apply Paeth rotation to the image",
- X "-scene value image scene number",
- X "-screen select image from root window",
- X "-verbose print detailed information about the image",
- X "-window id select window with this id or name",
- X (char *) NULL
- X };
- X (void) fprintf(stderr,"Usage: %s [options ...] file\n",client_name);
- X (void) fprintf(stderr,"\nWhere options include:\n");
- X for (p=options; *p != (char *) NULL; p++)
- X (void) fprintf(stderr," %s\n",*p);
- X (void) fprintf(stderr,
- X "\nChange '-' to '+' in any option above to reverse its effect.\n");
- X (void) fprintf(stderr,
- X "For example, +frame means do not include window manager frame.\n");
- X (void) fprintf(stderr,
- X "\nBy default, 'file' is written in the Postscript image format. To\n");
- X (void) fprintf(stderr,
- X "specify a particular image format, precede the filename with an image\n");
- X (void) fprintf(stderr,
- X "format name and a colon (i.e. ps:image) or specify the image type as\n");
- X (void) fprintf(stderr,
- X "the filename suffix (i.e. image.ps). Specify 'file' as '-' for\n");
- X (void) fprintf(stderr,"standard input or output.\n");
- X exit(1);
- }
- X
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a i n %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- %
- */
- int main(argc,argv)
- int
- X argc;
- X
- char
- X *argv[];
- {
- X char
- X *density,
- X *filename,
- X *option,
- X *page_geometry,
- X *resource_value,
- X *server_name,
- X *target_window;
- X
- X Display
- X *display;
- X
- X Image
- X *image;
- X
- X ImageInfo
- X image_info;
- X
- X int
- X degrees,
- X i,
- X x;
- X
- X time_t
- X start_time;
- X
- X unsigned int
- X borders,
- X compression,
- X descend,
- X frame,
- X interlace,
- X quality,
- X scene,
- X screen,
- X verbose;
- X
- X XResourceInfo
- X resource_info;
- X
- X XrmDatabase
- X resource_database,
- X server_database;
- X
- X /*
- X Display usage profile if there are no command line arguments.
- X */
- X client_name=(*argv);
- X if (argc < 2)
- X Usage();
- X /*
- X Connect to X server.
- X */
- X server_name=(char *) NULL;
- X for (i=1; i < argc; i++)
- X {
- X /*
- X Check command line for server name.
- X */
- X option=argv[i];
- X if (((int) strlen(option) > 1) && ((*option == '-') || (*option == '+')))
- X if (strncmp("dis",option+1,3) == 0)
- X {
- X /*
- X User specified server name.
- X */
- X i++;
- X if (i == argc)
- X Error("missing server name on -display",(char *) NULL);
- X server_name=argv[i];
- X break;
- X }
- X }
- X display=XOpenDisplay(server_name);
- X if (display == (Display *) NULL)
- X Error("unable to connect to X server",XDisplayName(server_name));
- X /*
- X Set our forgiving error handler.
- X */
- X XSetErrorHandler(XError);
- X /*
- X Initialize resource database.
- X */
- X XrmInitialize();
- X resource_database=XrmGetDatabase(display);
- X resource_value=XResourceManagerString(display);
- X if (resource_value == (char *) NULL)
- X resource_value="";
- X server_database=XrmGetStringDatabase(resource_value);
- X XrmMergeDatabases(server_database,&resource_database);
- X /*
- X Get user defaults from X resource database.
- X */
- X XGetResourceInfo(resource_database,client_name,&resource_info);
- X resource_value=XGetResource(resource_database,client_name,"borders","False");
- X borders=IsTrue(resource_value);
- X resource_value=
- X XGetResource(resource_database,client_name,"compression","Runlength");
- X if (Latin1Compare("qencoded",resource_value) == 0)
- X compression=QEncodedCompression;
- X else
- X compression=RunlengthEncodedCompression;
- X density=XGetResource(resource_database,client_name,"density",(char *) NULL);
- X resource_value=XGetResource(resource_database,client_name,"descend","False");
- X descend=IsTrue(resource_value);
- X resource_value=XGetResource(resource_database,client_name,"frame","False");
- X frame=IsTrue(resource_value);
- X resource_value=
- X XGetResource(resource_database,client_name,"interlace","none");
- X interlace=UndefinedInterlace;
- X if (Latin1Compare("none",resource_value) == 0)
- X interlace=NoneInterlace;
- X if (Latin1Compare("line",resource_value) == 0)
- X interlace=LineInterlace;
- X if (Latin1Compare("plane",resource_value) == 0)
- X interlace=PlaneInterlace;
- X if (interlace == UndefinedInterlace)
- X Warning("unrecognized interlace type",resource_value);
- X page_geometry=
- X XGetResource(resource_database,client_name,"pageGeometry",(char *) NULL);
- X resource_value=XGetResource(resource_database,client_name,"quality","75");
- X quality=atoi(resource_value);
- X resource_value=XGetResource(resource_database,client_name,"rotate","0");
- X degrees=atoi(resource_value);
- X resource_value=XGetResource(resource_database,client_name,"scene","0");
- X scene=atoi(resource_value);
- X resource_value=XGetResource(resource_database,client_name,"screen","False");
- X screen=IsTrue(resource_value);
- X resource_value=XGetResource(resource_database,client_name,"verbose","False");
- X verbose=IsTrue(resource_value);
- X /*
- X Check command syntax.
- X */
- X filename=(char *) NULL;
- X target_window=(char *) NULL;
- X for (i=1; i < argc; i++)
- X {
- X option=argv[i];
- X if (((int) strlen(option) < 2) || ((*option != '-') && (*option != '+')))
- X filename=argv[i];
- X else
- X switch(*(option+1))
- X {
- X case 'b':
- X {
- X borders=(*option == '-');
- X break;
- X }
- X case 'c':
- X {
- X compression=NoCompression;
- X if (*option == '-')
- X {
- X i++;
- X if (i == argc)
- X Error("missing type on -compress",(char *) NULL);
- X if ((*argv[i] == 'R') || (*argv[i] == 'r'))
- X compression=RunlengthEncodedCompression;
- X else
- X if ((*argv[i] == 'Q') || (*argv[i] == 'q'))
- X compression=QEncodedCompression;
- X else
- X Error("invalid compression type on -compress",(char *) NULL);
- X }
- X break;
- X }
- X case 'd':
- X {
- X if (strncmp("delay",option+1,3) == 0)
- X {
- X resource_info.delay=0;
- X if (*option == '-')
- X {
- X i++;
- X if ((i == argc) || !sscanf(argv[i],"%d",&x))
- X Error("missing seconds on -delay",(char *) NULL);
- X resource_info.delay=atoi(argv[i]);
- X }
- X break;
- X }
- X if (strncmp("density",option+1,3) == 0)
- X {
- X density=(char *) NULL;
- X if (*option == '-')
- X {
- X i++;
- X if (i == argc)
- X Error("missing geometry on -density",(char *) NULL);
- X density=argv[i];
- X }
- X break;
- X }
- X if (strncmp("descend",option+1,3) == 0)
- X {
- X descend=(*option == '-');
- X break;
- X }
- X if (strncmp("display",option+1,3) == 0)
- X {
- X server_name=(char *) NULL;
- X if (*option == '-')
- X {
- X i++;
- X if (i == argc)
- X Error("missing server name on -display",(char *) NULL);
- X server_name=argv[i];
- X }
- X break;
- X }
- X Error("unrecognized option",option);
- X break;
- X }
- X case 'f':
- X {
- X frame=(*option == '-');
- X break;
- X }
- X case 'g':
- X {
- X if (strncmp("geometry",option+1,2) == 0)
- X {
- X resource_info.image_geometry=(char *) NULL;
- X if (*option == '-')
- X {
- X i++;
- X if (i == argc)
- X Error("missing geometry on -geometry",(char *) NULL);
- X resource_info.image_geometry=argv[i];
- X }
- X break;
- X }
- X Error("unrecognized option",option);
- X break;
- X }
- X case 'h':
- X {
- X Usage();
- X break;
- X }
- X case 'i':
- X {
- X if (strncmp("interlace",option+1,3) == 0)
- X {
- X interlace=NoneInterlace;
- X if (*option == '-')
- X {
- X i++;
- X if (i == argc)
- X Error("missing type on -interlace",(char *) NULL);
- X option=argv[i];
- X interlace=UndefinedInterlace;
- X if (Latin1Compare("none",option) == 0)
- X interlace=NoneInterlace;
- X if (Latin1Compare("line",option) == 0)
- X interlace=LineInterlace;
- X if (Latin1Compare("plane",option) == 0)
- X interlace=PlaneInterlace;
- X if (interlace == UndefinedInterlace)
- X Error("invalid interlace type on -interlace",option);
- X }
- X break;
- X }
- X Error("unrecognized option",option);
- X break;
- X }
- X case 'm':
- X {
- X resource_info.monochrome=(*option == '-');
- X break;
- X }
- X case 'p':
- X {
- X if (strncmp("page",option+1,2) == 0)
- X {
- X page_geometry=(char *) NULL;
- X if (*option == '-')
- X {
- X i++;
- X if (i == argc)
- X Error("missing page geometry on -page",(char *) NULL);
- X page_geometry=argv[i];
- X }
- X break;
- X }
- X Error("unrecognized option",option);
- X break;
- X }
- X case 'q':
- X {
- X i++;
- X if ((i == argc) || !sscanf(argv[i],"%d",&x))
- X Error("missing quality on -quality",(char *) NULL);
- X quality=atoi(argv[i]);
- X break;
- X }
- X case 'r':
- X {
- X if (strncmp("rotate",option+1,3) == 0)
- X {
- X degrees=0;
- X if (*option == '-')
- X {
- X i++;
- X if ((i == argc) || !sscanf(argv[i],"%d",&x))
- X Error("missing degrees on -rotate",(char *) NULL);
- X degrees=atoi(argv[i]);
- X }
- X break;
- X }
- X Error("unrecognized option",option);
- X break;
- X }
- X case 's':
- X {
- X if (strncmp("scene",option+1,4) == 0)
- X {
- X i++;
- X if ((i == argc) || !sscanf(argv[i],"%d",&x))
- X Error("missing scene on -scene",(char *) NULL);
- X scene=atoi(argv[i]);
- X break;
- X }
- X if (strncmp("screen",option+1,4) == 0)
- X {
- X screen=(*option == '-');
- X break;
- X }
- X Error("unrecognized option",option);
- X break;
- X }
- X case 'w':
- X {
- X i++;
- X if (i == argc)
- X Error("missing id, name, or 'root' on -window",(char *) NULL);
- SHAR_EOF
- true || echo 'restore of ImageMagick/import.c failed'
- fi
- echo 'End of ImageMagick part 26'
- echo 'File ImageMagick/import.c is continued in part 27'
- echo 27 > _shar_seq_.tmp
- exit 0
-
- exit 0 # Just in case...
- --
- // chris@Sterling.COM | Send comp.sources.x submissions to:
- \X/ Amiga - The only way to fly! | sources-x@sterling.com
- "It's intuitively obvious to the |
- most casual observer..." | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
-