Skip to content

Pnm Picture Format Bibliography

LEADTOOLS Raster Imaging C API Help

Introduction

Version History

Version History

18 to 19

17.5 to 18

17 to 17.5

16.5 to 17

16 to 16.5

15 to 16

14.5 to 15

14 to 14.5

13 to 14

12.1 to 13

12 to 12.1

11.5 to 12

10 to 11 (11.5)

9.0 to 10

8.0 to 9.0

7.0 to 8.0

6.2 to 7.0

5.2 to 6.2

Getting Started

For Beginners

Tutorials For Beginners

Loading and Saving Images

Displaying an Image

Fitting an Image to a Window

Implementing Scrollbars

Printing an Image

Processing an Image

Implementing an Automated Annotation Program

Setting a Runtime License

Basic Concepts

Introduction: Animation

Introduction: Bitmaps in Memory and in Files

Introduction: Bits Per Pixel and Related Ideas

Introduction: Color Resolution and Dithering

Introduction: Data Transfer

Introduction: Database Interaction

Introduction: DIBs, DDBs, and the Clipboard

Introduction: Image Display

Introduction: Image Manipulation and Analysis

Introduction: Image Processing

Introduction: Palette Handling

Introduction: Printing

Introduction: TWAIN Input

Introduction: Intelligent Rescale

Programming with LEADTOOLS

Setting a Runtime License

Activating License Server

Supported Platforms / Operating Systems

Demo Programs

Considering Development Systems

Using LEADTOOLS with Your C/C++ Compiler

Memory Storage Types for Bitmaps

Callback Functions

Using the Intelligent Rescale Demo

LEADTOOLS Raster Imaging Features

File Formats

File Formats List

Files and File Formats

Summary of All Supported Image File Formats

LEADTOOLS Image Formats

LEADTOOLS Document Writers

LEADTOOLS OCR Output Formats

LEADTOOLS Silverlight

LEADTOOLS Multimedia Formats

LEADTOOLS Vector Formats

LEADTOOLS Metadata File Formats

File Formats for Which Redirected IO is Not Supported

Multipage File Formats

LEAD Image Optimizer Supported Formats

Color and Grayscale

File Formats: ABIC Format (ABIC, ICA)

File Formats: AFP/ PTOCA (AFP)

File Formats: Mayo Clinic Analyze (ANZ)

File Formats: BMP Formats

File Formats: Canon RAW Format (CRW)

File Formats: Cineon Format (CIN)

File Formats: DICOM Format (DIC)

File Formats: Digital Camera Format (DCF)

File Formats: Microsoft Office Word Document (DOC, DOCX)

File Formats: Dr. Halo (CUT)

File Formats: DWF Format (DWF)

File Formats: Encapsulated PostScript (EPS)

File Formats: Enhanced Compressed Wavelet Formats (ECW)

File Formats: Electronic Publishing Format (EPUB)

File Formats: Exif Formats (TIFF and JPG)

File Formats: FITS Format (FIT)

File Formats: Flic Animation (FLC)

File Formats: GIF Format (GIF)

File Formats: Hypertext Markup Language (HTML)

File Formats: Icons and Cursors

File Formats: Interchange File Format (IFF)

File Formats: Intergraph Raster File Format (INGR)

File Formats: JBIG Format (JBG)

File Formats: JPEG and LEAD Compressed (JPG, J2K, JP2, JPM, JLS, CMP, and CMW)

File Formats: JPEG XR (Jxr)/ Microsoft HD Photo File Format ( HDP)

File Formats: JPX

File Formats: Kodak Digital Camera Format (KDC)

File Formats: Kodak Formats (PCD and FPX)

File Formats: Kodak Professional Digital Camera Format (DCR)

File Formats: Kodak Professional Digital Camera System Format (DCS)

File Formats: LEADTOOLS Mixed Raster Content (LEAD MRC)

File Formats: LEADTOOLS PDF with Mixed Raster Content (PDF))

File Formats: Microsoft Windows Clipboard (CLP)

File Formats: Mixed Raster Content (MRC)

File Formats: Mobipocket Format (MOBI)

File Formats: MS Access Report Snapshots Format (SNP)

File Formats: MS Windows Thumbnail Cache Format (TDB)

File Formats: NITF Format (NTF)

File Formats: Paint Shop Pro Formats (PSP)

File Formats: PCX Formats (PCX and DCX)

File Formats: PhotoShop 3.0 Format (PSD)

File Formats: Personal Storage Tables, Messages and Emails (PST/MSG/EML)

File Formats: Portable Bitmap Utilities (PBM/PGM/PPM/PNM)

File Formats: Portable Document Format (PDF)

File Formats: Portable Network Graphics Formats (PNG and MNG)

File Formats: PostScript Document (PS)

File Formats: Microsoft PowerPoint Presentation Format (PPT, PPTX)

File Formats: PTOCA (MO:DCA PTOCA)

File Formats: Rich Text Format (RTF)

File Formats: Scitex Continuous Tone Format (SCT)

File Formats: Silicon Graphics Image Format (SGI)

File Formats: Structured Fax File Format (SFF)

File Formats: SUN Raster Format (RAS)

File Formats: SUN TCCA Visualization Format (VFF)

File Formats: Tagged Image File Format (TIFF and BigTIFF)

File Formats: Truevision TARGA Format (TGA)

File Formats: TXT (TXT)

File Formats: Windows Animated Cursor (ANI)

File Formats: Wireless Bitmap Format (WBMP)

File Formats: X Window Dump (XWD)

File Formats: ESRI Shape (SHP)

File Formats: XML Paper Specification (XPS)

File Formats: MS-Excel format (XLS, XLSX)

File Formats: XPicMap Format (XPM)

Bitonal (1-Bit)

File Formats: ABC (ABC)

File Formats: DWF Format (DWF)

File Formats: Image Object Content Architecture (IOCA)

File Formats: IntergraphRLE (ITG)

File Formats: Intergraph Raster File Formats (INGR)

File Formats: JBIG2 Format (JB2)

File Formats: LEAD 1-Bit Format (CMP)

File Formats: SMP (SMP)

File Formats: TIFF CCITT and Other FAX Formats

File Formats: Image Cash Letter (X9)

File Formats: XBitMap (XBM)

File Formats: Miscellaneous 1-Bit Formats (MAC, IMG, and MSP)

Vector

File Formats: ArcInfo Interchange File Format (E00)

File Formats: Computer Graphics Metafile (CGM)

File Formats: Compressed Windows Metafile Format (WMZ)

File Formats: Corel Presentation Exchange (CMX)

File Formats: DGN (DGN)

File Formats: DRaWing (DRW)

File Formats: Drawing Interchange Format (DXF)

File Formats: DWF Format (DWF)

File Formats: Autodesk DWF XPS (DWFX)

File Formats: DWG Format (DWG)

File Formats: ESRI Shape (SHP)

File Formats: Gerber Format (GBR)

File Formats: LEADTOOLS Vector Dump Format (VEC)

File Formats: Macintosh Pict Format (PCT)

File Formats: MapInfo Interchange File Format (MIF)

File Formats: NAPLPS Format (NAP)

File Formats: PLT (PLT)

File Formats: Printer Command Language (PCL)

File Formats: Scalable Vector Graphics (SVG)

File Formats: Windows Metafile Format (WMF)

File Formats: WordPerfect Format (WPG)

Vector Imaging

Vector Images

JBIG

Implementing JBIG Features

Exif

Implementing Exif Features

Exif File Comments

Exif File Extensions

FlashPix

Implementing PhotoCD and FlashPix Features

Implementing Extended FlashPix Support

FlashPix File Comments

FlashPix Structures

FlashPix Enumerated Types

FlashPix Transforms Options

JPEG 2000

Programming with JPEG 2000 Features

JPEG 2000 File Comments

JPX

Programming with JPX Features

JPX File Comments

Implementing GIF Features

Implementing PDF Features

Thumbnail

Thumbnail Browser

Thumbnail Functionality

Raster Image Functions: Using the Thumbnail Browser

Used Structures

THUMBOPTIONS

Image Compression

Compression Using LEAD and JPEG Formats

Compression Quality Factors

Super Compressed Bitmaps

Compressing and Decompressing Buffers

Image Compression Functionality

Raster Image Functions: Compression Functions

Annotations

Implementing Annotations

Implementing Custom Annotations

Automated User Interface for Annotations

Low-Level Coordinate System for Annotations

Implementing Annotation Security

Implementing Annotation Hyperlinks

Annotation Files

Undoing Automation Operations:

Annotation Tutorials

Annotation Toolbar Buttons

Fixed Annotations

The Annotation Text Token Table

Key Annotation Features

Annotation Tools

Audio Clip Tool

Button Tool

Closed Curve Tool

Crossproduct Tool

Curve Tool

Ellipse Tool

Encrypt Tool

Freehand Hot Spot Tool

Freehand Line Tool

Highlight Tool

Hot Spot Tool

Line Tool

Note Tool

Point Tool

Pointer Tool

Polygon Tool

Polyline Tool

Polyruler Tool

Protractor Tool

PushPin Tool

Rectangle Tool

Redaction Tool

Rich Text Tool

Rubber Stamp Tool

Ruler Tool

Selection Pointer Tool

Stamp Tool

Text Pointer Tool

Text Tool

Video Tool

Annotation Objects

Annotation Objects - Default Values

Displaying and Manipulating Annotation Objects

Creating, Deleting, and Copying Annotation Objects

Encryption and Decryption Annotation Objects

Obtaining Annotation Object Information

Altering Annotation Object Settings

Grouping and Ungrouping Annotation Objects

Using Rulers in Annotation Objects

Using Annotation Bitmap Objects

Flipping, Reversing and Rotating Annotation Objects

Calibrating Annotation Ruler Objects

Objects

Types of Annotations

Annotation Automation Object

Audio Clip Annotation Object

Button Annotation Object

Closed Curve Annotation Object

Container Annotation Object

Crossproduct Annotation Object

Curve Annotation Object

Ellipse Annotation Object

Encrypt Annotation Object

Freehand Hot Spot Annotation Object

Freehand Line Annotation Object

Highlight Annotation Object

Hot Spot Annotation Object

Line Annotation Object

Note Annotation Object

Point Annotation Object

Pointer Annotation Object

Polygon Annotation Object

Polyline Annotation Object

Polyruler Annotation Object

Protractor Annotation Object

PushPin Annotation Object

Rectangle Annotation Object

Redaction Annotation Object

Rich Text Annotation Object

Rubber Stamp Annotation Object

Ruler Annotation Object

Stamp Annotation Object

Text Annotation Object

Text Pointer Annotation Object

Video Annotation Object

Annotation Objects Functionality

Object Properties

Getting and Setting Color Properties

Getting and Setting Fill Properties

Getting and Setting Font Properties

Getting and Setting the Activation Property

Getting and Setting the Bitmap Property

Getting and Setting the Name Property

Getting and Setting Node Properties

Getting and Setting the ROP2 Property

Getting and Setting the Tag Property

Getting and Setting the Visible Property

Getting and Setting the Alpha Property

Getting and Setting Audio Properties

Getting and Setting Button Properties

Getting and Setting Closed Curve Properties

Getting and Setting Container Properties

Getting and Setting Cross product Properties

Getting and Setting Curve Properties

Getting and Setting Ellipse Properties

Getting and Setting Encrypt Properties

Getting and Setting the Fixed Property

Getting and Setting Freehand Hot Spot Properties

Getting and Setting Freehand Line Properties

Getting and Setting Highlight Properties

Getting and Setting Hot Spot Properties

Getting and Setting Line Properties

Getting and Setting Note Properties

Getting and Setting the Object Metafile Property

Getting and Setting Point Properties

Getting and Setting Pointer Properties

Getting and Setting Polygon Properties

Getting and Setting Polyline Properties

Getting and Setting Polyruler Properties

Getting and Setting Rubber Stamp Properties

Getting and Setting the Protractor Properties

A Netpbm format is any graphics format used and defined by the Netpbm project. The portable pixmap format (PPM), the portable graymap format (PGM) and the portable bitmap format (PBM) are image file formats designed to be easily exchanged between platforms. They are also sometimes referred to collectively as the portable anymap format (PNM),[4][5] not to be confused with the related portable arbitrary map format.

History[edit]

The PBM format was invented by Jef Poskanzer in the 1980s as a format that allowed monochrome bitmaps to be transmitted within an email message as plain ASCII text, allowing it to survive any changes in text formatting.[5] Poskanzer developed the first library of tools to handle the PBM format, Pbmplus, released in 1988. It mainly contained tools to convert between PBM and other graphics formats. By the end of 1988, Poskanzer had developed the PGM and PPM formats along with their associated tools and added them to Pbmplus. The final release of Pbmplus was December 10, 1991.

In 1993, the Netpbm library was developed to replace the unmaintained Pbmplus. It was simply a repackaging of Pbmplus with additions and fixes submitted by people all over the world.[6]

File format description[edit]

Each file starts with a two-byte magic number (in ASCII) that identifies the type of file it is (PBM, PGM, and PPM) and its encoding (ASCII or binary). The magic number is a capital P followed by a single-digit number.

TypeMagic numberExtensionColors
ASCIIBinary
Portable BitMap[1]0–1 (white & black)
Portable GrayMap[2]0–255 (gray scale)
Portable PixMap[3]0–255 (RGB)

A value of refers to the PAM file format that is covered as well by the netpbm library.[7]

The ASCII formats allow for human readability and easy transfer to other platforms; the binary formats are more efficient in file size but may have native byte-order issues.

In the binary formats, PBM uses 1 bit per pixel, PGM uses 8 bits per pixel, and PPM uses 24 bits per pixel: 8 for red, 8 for green, 8 for blue.

PBM example[edit]

A simple example of the PBM format is as follows (there is a newline character at the end of each line):

P1 # This is an example bitmap of the letter "J" 6 10 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0

The string P1 identifies the file format. The number sign introduces a comment. The next two numbers give the width and the height. Then follows the matrix with the pixel values (in the monochrome case here, only zeros and ones).

Here is the resulting image:

Here it is again magnified 20 times:

Note that a 0 signifies a white pixel, and a 1 signifies a black pixel. This is in contrast to the other formats, where higher values signify brighter pixels.

The P4 binary format of the same image represents each pixel with a single bit, packing 8 pixels per byte, with the first pixel as the most significant bit. Extra bits are added at the end of each row to fill a whole byte.

PGM example[edit]

The PGM and PPM formats (both ASCII and binary versions) have an additional parameter for the maximum value (numbers of grey between black and white) after the X and Y dimensions and before the actual pixel data. Black is 0 and max value is white. There is a newline character at the end of each line.

P2 # Shows the word "FEEP" (example from Netpbm man page on PGM) 24 7 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 3 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 15 15 15 0 0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 15 0 0 3 3 3 0 0 0 7 7 7 0 0 0 11 11 11 0 0 0 15 15 15 15 0 0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 0 0 0 3 0 0 0 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

PPM example[edit]

This is an example of a color RGB image stored in PPM format. There is a newline character at the end of each line.

P3 3 2 255 # The part above is the header # "P3" means this is a RGB color image in ASCII # "3 2" is the width and height of the image in pixels # "255" is the maximum value for each color # The part below is image data: RGB triplets 255 0 0 0 255 0 0 0 255 255 255 0 255 255 255 0 0 0

The P6 binary format of the same image represents each color component of each pixel with one byte (thus three bytes per pixel) in the order red, green, then blue. The file is smaller, but the color information is difficult to read by humans.

The PPM format is not compressed, and thus requires more space and bandwidth than a compressed format would. For example, the above 192×128 PNG (Portable Network Graphics) image has a file size of 166 bytes. When converted to a 192×128 PPM image, the file size is 73,848 bytes. The PPM format is generally an intermediate format used for image work before converting to a more efficient format, for example the PNG format, without any loss of information in the intermediate step.

The image shown above using only 0 or the maximal value for the red-green-blue channels can be also encoded as:

P3 # The same image with width 3 and height 2, # using 0 or 1 per color (red, green, blue) 3 2 1 1 0 0 0 1 0 0 0 1 1 1 0 1 1 1 0 0 0

White space including line ends and comment lines is syntactically equivalent to a single space within the PNM headers. For the plain formats P1…P3 this also affects the pixmap lines; in fact lines should be limited to 70 characters:

P3 3 2 1 1 0 0 0 1 0 0 0 1 1 1 0 1 1 1 0 0 0

16-bit extensions[edit]

The original definition of the PGM and the PPM binary formats (the P5 and P6 formats) did not allow bit depths greater than 8 bits. One can of course use the ASCII format, but this format both slows down reading and makes the files much larger. Accordingly, many programmers extended the format to allow higher bit depths. Using higher bit depths encounters the problem of having to decide on the endianness of the file. The various implementations could not agree on which byte order to use, and some connected the 16-bit endianness to the pixel packing order.[8] In Netpbm, the de facto standard implementation of the PNM formats, the most significant byte is first.[9]

Common RGBcolor depths include 24 = (3 × 8), 30 = (3 × 10), 32 = (4 × 8), 36 = (3 × 12), 48 = (3 × 16), and 64 = (4 × 16) (with three red–green–blue channels, and a fourth unused or RGBAalpha channel, respectively). Classic XnView can read rgb48be PPM, FFmpeg can also create rgb48be PPM.[10]

While 30 = (3 × 10) could fit into 32 bits, this is not supported by the binary PNM and PAM formats. All PPM bit depths with more than 8 bits are encoded in 48 bits. More than 8 gray bits end up as 16 bits without transparency (FFmpeg PGM or PAM pix_fmt gray16be).

PGMYUV is a PGM variant only used by FFmpeg.[citation needed]

See also[edit]

References[edit]

External links[edit]