plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

crop.1 (2603B)


      1 .TH CROP 1
      2 .SH NAME
      3 crop, iconv \- frame, crop, and convert image
      4 .SH SYNOPSIS
      5 .B crop
      6 [
      7 .BI -c
      8 .I red
      9 .I green
     10 .I blue
     11 ]
     12 [
     13 .B -i
     14 .I n
     15 |
     16 .B -x
     17 .I dx
     18 |
     19 .B -y
     20 .I dy
     21 |
     22 .B -r
     23 .I minx
     24 .I miny
     25 .I maxx
     26 .I maxy
     27 ]
     28 [
     29 .B -t
     30 .I tx
     31 .I ty
     32 ]
     33 [
     34 .B -b
     35 .I red
     36 .I green
     37 .I blue
     38 ]
     39 [
     40 .I file
     41 ]
     42 .PP
     43 .B iconv
     44 [
     45 .B -u
     46 ] [
     47 .B -c
     48 .I chandesc
     49 ]
     50 [
     51 .I file
     52 ]
     53 .SH DESCRIPTION
     54 .I Crop
     55 reads an
     56 .MR image (7)
     57 file (default standard input), crops it, and writes it as a compressed
     58 .MR image (7)
     59 file to standard output.
     60 There are two ways to specify a crop, by color value or by geometry.
     61 They may be combined in a single run of
     62 .IR crop ,
     63 in which case the color value crop will be done first.
     64 .PP
     65 The
     66 .B -c
     67 option takes a red-green-blue triplet as described in
     68 .MR color (3) .
     69 (For example, white
     70 is
     71 .B 255
     72 .B 255
     73 .BR 255 .)
     74 The corresponding color is used as a value to be cut from the outer
     75 edge of the picture; that is, the image is cropped to remove the maximal
     76 outside rectangular strip in which every pixel has the specified color.
     77 .PP
     78 The
     79 .B -i
     80 option insets the image rectangle by a constant amount,
     81 .IR n ,
     82 which may be negative to generate extra space around the image.
     83 The
     84 .B -x
     85 and
     86 .B -y
     87 options are similar, but apply only to the
     88 .I x
     89 or
     90 .I y
     91 coordinates of the image.
     92 .PP
     93 The
     94 .B -r
     95 option specifies an exact rectangle.
     96 .PP
     97 The 
     98 .B -t
     99 option specifies that the image's coordinate system should
    100 be translated by
    101 .IR tx ,
    102 .IR ty
    103 as the last step of processing.
    104 .PP
    105 The
    106 .B -b
    107 option specifies a background color to be used to fill around the image
    108 if the cropped image is larger than the original, such as if the
    109 .B -i
    110 option is given a negative argument.
    111 This can be used to draw a monochrome frame around the image.
    112 The default color is black.
    113 .PP
    114 .I Iconv
    115 changes the format of pixels in the image
    116 .I file
    117 (default standard input) and writes the resulting image to standard output.
    118 Pixels in the image are converted according to the channel descriptor
    119 .IR chandesc ,
    120 (see
    121 .MR image (7) ).
    122 For example, to convert a 4-bit-per-pixel grey-scale image to an 8-bit-per-pixel
    123 color-mapped image,
    124 .I chandesc
    125 should be
    126 .BR m8 .
    127 If
    128 .I chandesc
    129 is not given, the format is unchanged.
    130 The output image is by default compressed; the
    131 .B -u
    132 option turns off the compression.
    133 .SH EXAMPLE
    134 To crop white edges off the picture and add a ten-pixel pink border,
    135 .IP
    136 .EX
    137 crop -c 255 255 255 -i -10 -b 255 150 150 imagefile > cropped
    138 .EE
    139 .SH SOURCE
    140 .B \*9/src/cmd/draw/crop.c
    141 .SH SEE ALSO
    142 .MR image (7) ,
    143 .MR color (3)
    144 .SH BUGS
    145 .I Iconv
    146 should be able to do Floyd-Steinberg error diffusion or dithering
    147 when converting to small image depths.