PCX

Last updated
PCX
Filename extension
.pcx
Internet media type image/vnd.zbrush.pcx, image/x-pcx (deprecated) [1]
Developed byZSoft Corporation
Initial release1985;39 years ago (1985)
Latest release
5
1991;33 years ago (1991)
Type of format Lossless bitmap image format

PCX, standing for PiCture eXchange, is an image file format developed by the now-defunct ZSoft Corporation of Marietta, Georgia, United States. It was the native file format for PC Paintbrush and became one of the first widely accepted DOS imaging standards, although it has since been succeeded by more sophisticated image formats, such as BMP, JPEG, and PNG. PCX files commonly store palette-indexed images ranging from 2 or 4 colors to 16 and 256 colors, although the format has been extended to record true-color (24-bit) images as well. [2]

Contents

PCX image formats

PCX was designed during the early development of PC display hardware and most of the formats it supported are no longer used. The table below shows a list of the most commonly used PCX formats. Contemporary image editing programs may not read PCX files that match older hardware.

Common PCX Image Formats[ citation needed ]
Bit DepthPlanesNumber of Colors
4116 colors from a palette
81256 colors from a palette
81256 shades of gray
444096 colors with 16 levels of transparency
8316.7 million, 24-bit "true color"
8416.7 million with 256 levels of transparency
112 colors monochrome (1-Bit) (Win 3.1 Paintbrush)
1416 colors RGBi (4-Bit) in 4 planes (Win 3.1 Paintbrush)

PCX is supported by common image processing software including ACDSee, FastStone, GIMP, ImageMagick, IrfanView, LView, Netpbm, PaintShop Pro, Photoshop, Visio, PMview, XnView and GraphicConverter. [3] [4] In version 2.1.4 FFmpeg could encode and decode the PCX pixel formats rgb24, rgb8, bgr8, rgb4_byte, bgr4_byte, gray, pal8, and monob. [5]

There is a multi-page version of PCX, used by some computer fax and document management programs, with file extension .dcx. A DCX file consists of a header introducing a set of following PCX files. [6]

PCX file format

PCX files were designed for use on IBM-compatible PCs and always use little endian byte ordering. A PCX file has three main sections, in the following order

  1. 128-byte header
  2. image data
  3. (optional) 256-color palette

The PCX file header contains an identifier byte (value 10), a version number, image dimensions, 16 palette colors, number color planes, bit depth of each plane, and a value for compression method. PCX version numbers range from 0 to 5, this originally denoted the version of the PC Paintbrush program used to create the PCX file. The header always has space for 16 colors though the number of colors used depends upon the bit depth of the image.[ clarification needed ] The header is composed of 18 fields: [7] [2]

Offset hexOffset decSizePurpose
0001 byteThe fixed header field valued at a hexadecimal 0x0A (= 10 in decimal).
0111 byteThe version number referring to the Paintbrush software release, which might be:
0
PC Paintbrush version 2.5 using a fixed EGA palette
2
PC Paintbrush version 2.8 using a modifiable EGA palette
3
PC Paintbrush version 2.8 using no palette
4
PC Paintbrush for Windows
5
PC Paintbrush version 3.0, including 24-bit images
0221 byteThe method used for encoding the image data. Can be:
0
No encoding (rarely used)
1
Run-length encoding (RLE)
0331 byteThe number of bits constituting one plane. Most often 1, 2, 4 or 8.
0442 bytesThe minimum x co-ordinate of the image position.
0662 bytesThe minimum y co-ordinate of the image position.
0882 bytesThe maximum x co-ordinate of the image position.
0A102 bytesThe maximum y co-ordinate of the image position.
0C122 bytesThe horizontal image resolution in DPI.
0E142 bytesThe vertical image resolution in DPI.
101648 bytesThe EGA palette for 16-color images.
40641 byteThe first reserved field, usually set to zero.
41651 byteThe number of color planes constituting the pixel data. Mostly chosen to be 1, 3, or 4.
42662 bytesThe number of bytes of one color plane representing a single scan line.
44682 bytesThe mode in which to construe the palette:
1
The palette contains monochrome or color information
2
The palette contains grayscale information
46702 bytesThe horizontal resolution of the source system's screen.
48722 bytesThe vertical resolution of the source system's screen.
4A7454 bytesThe second reserved field, intended for future extensions, and usually set to zero bytes.

All PCX files use the same compression scheme and the compression value is always 1. No other values have been defined and there are no uncompressed PCX files. One source claims that 0 (uncompressed) is allowed, but not much software supports it. [8]

Image data layout

PCX image data is stored in rows or scan lines in top-down order. If the image has multiple planes, these are stored by plane within row, such that all the red data for row 0 are followed by all the green data for row 0, then all the blue data, then alpha data. This pattern is repeated for each line as shown in the next table:

PCX Image Data Arranged into Color Planes
Row 0R R R R R R R R R
G G G G G G G G
B B B B B B B B B
A A A A A A A A A
Row 1R R R R R R R R R
G G G G G G G G
B B B B B B B B B
A A A A A A A A A
Row 2 etc.....

When an image is less than 8 bits per pixel, each line is padded to the next even byte boundary. [7] For example, if an image has 1 plane of 1-bit data (monochrome) with a width of 22 pixels, each row will be 4 bytes long, having 32 bits per row with 10 bits unused.

Image data compression

PCX image data are compressed using run-length encoding (RLE), a simple lossless compression algorithm that collapses a series of three or more consecutive bytes with identical values into a two-byte pair. The two most-significant bits of a byte are used to determine whether the given data represent a single pixel of a given palette index or color value, or an RLE pair representing a series of several pixels of a single value:

  1. If both bits are 1, the byte is interpreted as the run length. This leaves 6 bits for the actual run length value, a range of 0-63.
  2. In any other case, the byte is interpreted as a single pixel value. This leaves all values for which bit #7 and bit #8 are not 1 at the same time. This allows all values under 192 to be encoded in a single byte.

Due to the use of the two most-significant bits as flags, pixel values from 192 to 255 (with their most-significant bit already set) must be stored in an RLE byte pair, even when they only occur one or two pixels in succession, whereas color indexes 0 to 191 can be stored directly or in RLE byte pairs (whichever is more space-efficient); therefore, the actual compression ratio could be optimized with proper sorting of palette entries, though this is not feasible where the file must share its color palette with other images. For example, a palette could be optimized with the most commonly used colors occurring in palette positions 0 to 191 and the least common colors allocated to the remaining quarter of the palette.

Another inefficiency with the RLE algorithm is that it is possible to store chunks with a length of 0, which allows whitespace in the file. This allowed PCX files to be decompressed slightly faster[ how? ] on the processors it was originally intended for.[ contradictory ]

The PCX compression algorithm requires very little processor power or memory to apply, a significant concern with computer systems when it was designed. Compression algorithms used by newer image formats are more efficient when compressing images such as photographs, and dithered or otherwise complex graphics.

Color palette

A PCX file has space in its header for a 16 color palette. When 256-color VGA hardware became available there was not enough space for the palette in a PCX file; even the 54 unused bytes after the header would not be enough. The solution chosen was to put the palette at the end of the file, along with a marker byte to confirm its existence.

If a PCX file has a 256-color palette, it is found 768 bytes from the end of the file. In this case the value in the byte preceding the palette should be 12 (0x0C). The palette is stored as a sequence of RGB triples; its usable length is defined by the number of colors in the image. Colors values in a PCX palette always use 8 bits, regardless of the bit depth of the image.

Related Research Articles

<span class="mw-page-title-main">GIF</span> Bitmap image file format family

The Graphics Interchange Format is a bitmap image format that was developed by a team at the online services provider CompuServe led by American computer scientist Steve Wilhite and released on June 15, 1987.

<span class="mw-page-title-main">PNG</span> Family of lossless compression file formats for image files

Portable Network Graphics is a raster-graphics file format that supports lossless data compression. PNG was developed as an improved, non-patented replacement for Graphics Interchange Format (GIF)—unofficially, the initials PNG stood for the recursive acronym "PNG's not GIF".

<span class="mw-page-title-main">Raster graphics</span> Matrix-based data structure

In computer graphics and digital photography, a raster graphic represents a two-dimensional picture as a rectangular matrix or grid of square pixels, viewable via a computer display, paper, or other display medium. A raster is technically characterized by the width and height of the image in pixels and by the number of bits per pixel. Raster images are stored in image files with varying dissemination, production, generation, and acquisition formats.

Run-length encoding (RLE) is a form of lossless data compression in which runs of data are stored as a single data value and count, rather than as the original run. This is most efficient on data that contains many such runs, for example, simple graphic images such as icons, line drawings, Conway's Game of Life, and animations. For files that do not have many runs, RLE could increase the file size.

Tag Image File Format or Tagged Image File Format, commonly known by the abbreviations TIFF or TIF, is an image file format for storing raster graphics images, popular among graphic artists, the publishing industry, and photographers. TIFF is widely supported by scanning, faxing, word processing, optical character recognition, image manipulation, desktop publishing, and page-layout applications. The format was created by the Aldus Corporation for use in desktop publishing. It published the latest version 6.0 in 1992, subsequently updated with an Adobe Systems copyright after the latter acquired Aldus in 1994. Several Aldus or Adobe technical notes have been published with minor extensions to the format, and several specifications have been based on TIFF 6.0, including TIFF/EP, TIFF/IT, TIFF-F and TIFF-FX.

The BMP file format or bitmap, is a raster graphics image file format used to store bitmap digital images, independently of the display device, especially on Microsoft Windows and OS/2 operating systems.

<span class="mw-page-title-main">ILBM</span> File format

Interleaved Bitmap (ILBM) is an image file format conforming to the Interchange File Format (IFF) standard. The format originated on the Amiga platform, and on IBM-compatible systems, files in this format or the related PBM format are typically encountered in games from late 1980s and early 1990s that were either Amiga ports or had their graphical assets designed on Amiga machines.

Truevision TGA, often referred to as TARGA, is a raster graphics file format created by Truevision Inc.. It was the native format of TARGA and VISTA boards, which were the first graphic cards for IBM-compatible PCs to support Highcolor/truecolor display. This family of graphic cards was intended for professional computer image synthesis and video editing with PCs; for this reason, usual resolutions of TGA image files match those of the NTSC and PAL video formats.

<span class="mw-page-title-main">X PixMap</span> Image file format

X PixMap (XPM) is an image file format used by the X Window System, created in 1989 by Daniel Dardailler and Colas Nahaboo working at Bull Research Center at Sophia Antipolis, France, and later enhanced by Arnaud Le Hors.

<span class="mw-page-title-main">Smacker video</span> Digital video file format

Smacker video is a video file format developed by Epic Games Tools, and primarily used for full-motion video in video games. Smacker uses an adaptive 8-bit RGB palette. RAD's format for video at higher color depths is Bink Video. The Smacker format specifies a container format, a video compression format, and an audio compression format. Since its release in 1994, Smacker has been used in over 2300 games. Blizzard used this format for the cinematic videos seen in its games Warcraft II, StarCraft and Diablo I.

<span class="mw-page-title-main">X BitMap</span> File format

In computer graphics, the X Window System used X BitMap (XBM), a plain text binary image format, for storing cursor and icon bitmaps used in the X GUI. The XBM format is superseded by XPM, which first appeared for X11 in 1989.

The ICO file format is an image file format for computer icons in Microsoft Windows. ICO files contain one or more small images at multiple sizes and color depths, such that they may be scaled appropriately. In Windows, all executables that display an icon to the user, on the desktop, in the Start Menu, or in file Explorer, must carry the icon in ICO format.

An image file format is a file format for a digital image. There are many formats that can be used, such as JPEG, PNG, and GIF. Most formats up until 2022 were for storing 2D images, not 3D ones. The data stored in an image file format may be compressed or uncompressed. If the data is compressed, it may be done so using lossy compression or lossless compression. For graphic design applications, vector formats are often used. Some image file formats support transparency.

In computing, indexed color is a technique to manage digital images' colors in a limited fashion, in order to save computer memory and file storage, while speeding up display refresh and file transfers. It is a form of vector quantization compression.

The Apple Icon Image format (.icns) is an icon format used in Apple Inc.'s macOS. It supports icons of 16 × 16, 32 × 32, 48 × 48, 128 × 128, 256 × 256, 512 × 512 points at 1x and 2x scale, with both 1- and 8-bit alpha channels and multiple image states. The fixed-size icons can be scaled by the operating system and displayed at any intermediate size.

Silicon Graphics Image (SGI) or the RGB file format is the native raster graphics file format for Silicon Graphics workstations. The format was invented by Paul Haeberli. It can be run-length encoded (RLE). FFmpeg and ImageMagick, among others, support this format.

PICtor is an image file format developed by John Bridges, the principal author of PCPaint, the first Paintbrush program for the PC. It was also the native file format for Pictor Paint and Graphics Animation System for Professionals (GRASP) and became the first widely accepted DOS imaging standard.

In computing, a bitmap is a mapping from some domain to bits. It is also called a bit array or bitmap index.

QuickTime Graphics is a lossy video compression and decompression algorithm (codec) developed by Apple Inc. and first released as part of QuickTime 1.x in the early 1990s. The codec is also known by the name Apple Graphics and its FourCC SMC. The codec operates on 8-bit palettized RGB data. The bit-stream format of QuickTime Graphics has been reverse-engineered and a decoder has been implemented in the projects XAnim and libavcodec.

The Quite OK Image Format (QOI) is a specification for lossless image compression of 24-bit or 32-bit color raster (bitmapped) images, invented by Dominic Szablewski and first announced on 24 November 2021.

References

  1. .pcx MIME type not registered at IANA
  2. 1 2 James D. Murray; William vanRyper (April 1996). "Encyclopedia of Graphics File Formats, Second Edition" . O'Reilly. ISBN   1-56592-161-5 . Retrieved 2014-03-07.
  3. Nir Sofer. ".pcx Extension" . Retrieved 2014-01-12.
  4. "File Type: Microsoft PaintBrush Bitmap Graphic". Windows File Association. Microsoft. 2013. Archived from the original on 2014-03-14. Retrieved 2014-03-14.
  5. "Image Formats". FFmpeg General Documentation. 2014. Retrieved 2014-02-23.
  6. ".DCX File Extension". fileinfo.com. 2010-02-19. Retrieved 2014-03-14.
  7. 1 2 Dean Ansley (1991). "ZSoft PCX File Format Technical Reference Manual". ZSoft Corporation. Archived from the original on 2014-03-14. Retrieved 2014-03-14.
  8. "PCX Format". ModdingWiki. 2012-06-23. Retrieved 2014-03-14.