1nearblack(1)                General Commands Manual               nearblack(1)
2
3
4

NAME

6       nearblackConvert nearly black/white borders to black.
7

SYNOPSIS

9       nearblack [-of format] [-white | [-color c1,c2,c3...cn]*] [-near dist] [-nb non_black_pixels]
10                 [-setalpha] [-setmask] [-o outfile] [-q]  [-co "NAME=VALUE"]* infile
11

DESCRIPTION

13       This utility will scan an image and try to set all pixels that are
14       nearly or exactly black, white or one or more custom colors around the
15       collar to black or white. This is often used to 'fix up' lossy
16       compressed air photos so that color pixels can be treated as
17       transparent when mosaicing.
18
19       -o outfile:
20           The name of the output file to be created.
21
22       -of format:
23           (GDAL 1.8.0 or later) Select the output format. Starting with GDAL
24           2.3, if not specified, the format is guessed from the extension
25           (previously was ERDAS Imagine .img). Use the short format name
26           (GTiff for GeoTIFF for example).
27
28       -co 'NAME=VALUE':
29           (GDAL 1.8.0 or later) Passes a creation option to the output format
30           driver. Multiple -co options may be listed. See format specific
31           documentation for legal creation options for each format. Only
32           valid when creating a new file
33
34       -white:
35           Search for nearly white (255) pixels instead of nearly black
36           pixels.
37
38       -color c1,c2,c3...cn:
39           (GDAL >= 1.9.0) Search for pixels near the specified color. May be
40           specified multiple times. When -color is specified, the pixels that
41           are considered as the collar are set to 0.
42
43       -near dist:
44           Select how far from black, white or custom colors the pixel values
45           can be and still considered near black, white or custom color.
46           Defaults to 15.
47
48       -nb non_black_pixels:
49           number of non-black pixels that can be encountered before the
50           giving up search inwards. Defaults to 2.
51
52       -setalpha:
53           (GDAL 1.8.0 or later) Adds an alpha band if the output file is
54           specified and the input file has 3 bands, or sets the alpha band of
55           the output file if it is specified and the input file has 4 bands,
56           or sets the alpha band of the input file if it has 4 bands and no
57           output file is specified. The alpha band is set to 0 in the image
58           collar and to 255 elsewhere.
59
60       -setmask:
61           (GDAL 1.8.0 or later) Adds a mask band to the output file, or adds
62           a mask band to the input file if it does not already have one and
63           no output file is specified. The mask band is set to 0 in the image
64           collar and to 255 elsewhere.
65
66       -q:
67           (GDAL 1.8.0 or later) Suppress progress monitor and other non-error
68           output.
69
70       infile:
71           The input file. Any GDAL supported format, any number of bands,
72           normally 8bit Byte bands.
73
74       The algorithm processes the image one scanline at a time. A scan 'in'
75       is done from either end setting pixels to black or white until at least
76       'non_black_pixels' pixels that are more than 'dist' gray levels away
77       from black, white or custom colors have been encountered at which point
78       the scan stops. The nearly black, white or custom color pixels are set
79       to black or white. The algorithm also scans from top to bottom and from
80       bottom to top to identify indentations in the top or bottom.
81
82       The processing is all done in 8bit (Bytes).
83
84       If the output file is omitted, the processed results will be written
85       back to the input file - which must support update.
86

C API

88       Starting with GDAL 2.1, this utility is also callable from C with
89       GDALNearblack().
90

AUTHORS

92       Frank Warmerdam warmerdam@pobox.com
93
94
95
96GDAL                            Wed Oct 3 2018                    nearblack(1)
Impressum