PBM (.pbm)
- Import and Export fully support the PBM format.
- Export creates binary PBM files.
- If multiple images are present in a PBM file, Import returns the first of the images.
Background & Context
-
- MIME type: image/x-portable-bitmap
- PBM monochrome raster image format.
- Member of the Portable family of image formats.
- Related to PGM and PPM.
- Implements a subset of the PNM format.
- Native format of the Netpbm graphics software package.
- Primarily used as an intermediate file format on Unix systems.
- PBM is an acronym derived from Portable Bit Map.
- ASCII or binary format.
- Stores raster images formatted as plain text, representing each pixel as a 0 (white) or 1 (black).
- Developed in 1988 as part of the Pbmplus package.
Import & Export
- Import["file.pbm"] imports a PBM file, returning an Image object.
- Import["file.pbm",elem] imports the specified element from a PBM file.
- The import format can be specified with Import["file","PBM"] or Import["file",{"PBM",elem,…}].
- Export["file.pbm",expr] exports an image, graphics, or any other expression as a raster image to PBM.
- Export by default generates binary PBM files.
- When exporting Wolfram Language graphics or arbitrary expressions to PBM, the resulting image has the same raster size as its displayed form.
- Image objects are by default exported at their raster size.
- Because PBM is a raster image format, all fonts are rasterized on export.
- See the following reference pages for full general information:
-
Import, Export import from or export to a file CloudImport, CloudExport import from or export to a cloud object ImportString, ExportString import from or export to a string ImportByteArray, ExportByteArray import from or export to a byte array
Notebook Interface
- In the notebook front end, Insert ▶ Picture and the Open menu allow import of a PBM file into a cell.
- Save Selection As exports the selected part of a notebook as a PBM file.
Import Elements
- General Import elements:
-
"Elements" list of elements and options available in this file "Summary" summary of the file "Rules" list of rules for all available elements - Data representation elements:
-
"Data" array of grayscale values "Graphics" Graphics object representing an image "Image" raster image, given as an Image object - Import and Export by default use the "Image" element for PBM files.
- Advanced Import elements:
-
"BitDepth" bits used to represent each color channel in the file "Channels" the number of color channels used in the file "ColorSpace" color space of the image "DataType" data type used for storing pixel elements "ImageSize" raster dimensions "Summary" summary of the file
Examples
Basic Examples (3)
This imports a PBM example file and renders it as Graphics: