MB-System Unix Manual Page

mbtiff2png

Section: MB-System 5.0 (1)
Updated: 6 June 2021
Index
 

NAME

mbtiff2png - Convert GeoTiff images to PNG format images setting no data regions to be transparent.

 

VERSION

Version 5.0

 

SYNOPSIS

mbtiff2png --input=inputGeoTiffFile [--world=inputWorldFile= --output=outputPNGFile --transparency-white --transparency-light=threshold --transparency-black --transparency-dark=threshold --verbose --help]

 

DESCRIPTION

Mbtiff2png converts a GeoTiff image generated by the MB-System GMT module mbgrdtiff or the macro mbm_grdtiff into a PNG format image. Although GeoTiff images are advantageous with respect to having the associated geodetic information embedded in the image file, the Tiff standard does not support transparency and so cannot represent no data regions as transparent when imported into a GIS. The conversion done by Mbtiff2png can include setting no data regions to be transparent. The no data regions can be specified as being white, black, or lighter or darker than a threshold. The threshold is specified as an integer between 0 and 255, where 0 is black and 255 is white. Since the PNG image format does not support embedded geodetic information, making the output image importable into a GIS depends on the parallel world file. ESRI raster world files (e.g. https://en.wikipedia.org/wiki/World_file) are six line plain text files that define the location, scale, and rotation of a raster on a map. Mbtiff2png simply copies the GeoTiff world file to be parallel to the output PNG file with a ".pgw" suffix.

 

MB-SYSTEM AUTHORSHIP

David W. Caress

  Monterey Bay Aquarium Research Institute
Dale N. Chayes

  Center for Coastal and Ocean Mapping

  University of New Hampshire
Christian do Santos Ferreira

  MARUM - Center for Marine Environmental Sciences

  University of Bremen

 

OPTIONS

--help
This "help" flag cause the program to print out a description of its operation and then exit immediately.
--input=inputGeoTiffFile

Sets the filename of the input GeoTiff file. This file must have a valid parallel world file with suffix *.tfw
--world=inputWorldFile

Sets the filename of the input world file. Image world files have the form
--output=outputPNGFile

Sets the filename of the input GeoTiff file. This file must have a valid parallel world file with suffix *.tfw
--transparency-white

Input pixels that are white, with BGR values all equal to 255, will be set transparent in the output PNG image file. The pixel colors are presumed to be defined by single byte blue, green, and red values with a range of 0 to 255.
--transparency-light=threshold

Input pixels with BGR average values greater than or equal to threshold will be set transparent in the output PNG image file. The threshold value is an integer from 0 to 255. The pixel colors are presumed to be defined by single byte blue, green, and red values with a range of 0 to 255. The average BGR value is int((blue+green+red)/3).
--transparency-black

Input pixels that are black, with BGR values all equal to 0, will be set transparent in the output PNG image file. The pixel colors are presumed to be defined by single byte blue, green, and red values with a range of 0 to 255.
--transparency-dark=threshold

Input pixels with BGR average values less than or equal to threshold will be set transparent in the output PNG image file. The threshold value is an integer from 0 to 255. The pixel colors are presumed to be defined by single byte blue, green, and red values with a range of 0 to 255. The average BGR value is int((blue+green+red)/3).
--verbose
The --verbose option causes mbtiff2png to print out status messages.

 

EXAMPLES

Suppose that we have topography in a UTM zone 10 projected grid named OctopusGarden_LASS_MB_Topo_5cm_UTM.grd. We can use mbm_grdtiff to generate a script named OctopusGarden_LASS_MB_Topo_5cm_UTM_Slope_tiff.cmd that in turn generates a slope shaded GeoTiff image of the topography:

  mbm_grdtiff -I OctopusGarden_LASS_MB_Topo_5cm_UTM.grd               -O OctopusGarden_LASS_MB_Topo_5cm_UTM_Slope               -G5 -A0.3 -D0/1               -WOctopusGarden_LASS_Topo.cpt               -V
  OctopusGarden_LASS_MB_Topo_5cm_UTM_Slope_tiff.cmd
However, the no data regions of the grid will be represented with the color white in the GeoTiff OctopusGarden_LASS_MB_Topo_5cm_UTM_Slope.tif because the Tiff format does not support transparency. In order to translate the GeoTiff to the PNG format with the white areas set transparent, use mbtiff2png as follows:


  mbtiff2png --input=OctopusGarden_LASS_MB_Topo_5cm_UTM_Slope.tif               --transparency-white               --verbose
Running the example above produced the following output to the shell:


  Wrote output BGRA png image OctopusGarden_LASS_MB_Topo_5cm_UTM_Slope.png
  Copied world file from OctopusGarden_LASS_MB_Topo_5cm_UTM_Slope.tfw to OctopusGarden_LASS_MB_Topo_5cm_UTM_Slope.pgw

 

SEE ALSO

mbsystem(1), mbgrid(1), mbmosaic(1), mbm_arc2grd(1), mbm_grid(1)

 

BUGS

Maybe. Maybe not.


 

Index

NAME
VERSION
SYNOPSIS
DESCRIPTION
MB-SYSTEM AUTHORSHIP
OPTIONS
EXAMPLES
SEE ALSO
BUGS


Last Updated: 6 June 2021


<< Manual page for the MB-System package | MB-System website >>