Content deleted Content added
m Task 18 (cosmetic): eval 7 templates: hyphenate params (7×); |
m Reverted edit by Manwichosu (talk) to last version by Timwi |
||
(27 intermediate revisions by 20 users not shown) | |||
Line 1:
{{short description|Image file format}}
{{about|the image file format|the stock exchange|Pacific Exchange|the motorcycle|Honda PCX|}}
{{Infobox file format
Line 16 ⟶ 17:
| extended to =
}}
'''PCX''', standing for ''PiCture eXchange'', is an [[graphics file formats|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 [[MS-DOS|DOS]] imaging standards, although it has since been succeeded by more sophisticated image formats, such as [[BMP file format|BMP]], [[JPEG]], and [[Portable Network Graphics|PNG]]. PCX files commonly
{{cite
| title=Encyclopedia of Graphics File Formats, Second Edition
| date=April 1996
|
| author2=William vanRyper | isbn=1-56592-161-5
| publisher=[[O'Reilly Media|O'Reilly]]
Line 29 ⟶ 31:
==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
{| class="wikitable"
|+
! Bit Depth || Planes || Number of Colors
|-
Line 50 ⟶ 52:
| 1 || 4 || 16 colors RGBi (4-Bit) in 4 planes (Win 3.1 Paintbrush)
|}
▲PCX was designed during the early development of PC display hardware and most of the formats it supported are no longer used, Table A shows a list of the most commonly used PCX formats. Contemporary image editing programs may not read PCX files that match older hardware.
PCX is supported by common image processing software including [[ACDSee]], [[FastStone]], [[GIMP]], [[ImageMagick]], [[IrfanView]], [[LView]], [[Netpbm]], [[PaintShop Pro]], [[Photoshop Elements|Photoshop]], [[Microsoft Visio|Visio]], [[PMview]], [[XnView]] and [[GraphicConverter]].<ref>{{cite web|url=http://extension.nirsoft.net/ras|title=.pcx Extension|author=Nir Sofer|access-date=2014-01-12}}</ref><ref>{{cite web|url=http://shell.windows.com/fileassoc/0409/xml/redir.asp?EXT=pcx|publisher=[[Microsoft]]|work=Windows File Association
|title=File Type: Microsoft PaintBrush Bitmap Graphic|year=2013|access-date=2014-
There is a multi-page version of PCX, used by some computer [[fax]] and document management programs, with file extension <code>.dcx</code>. A DCX file consists of a header introducing a set of following PCX files.<ref>{{cite web|url=http://www.fileinfo.com/extension/dcx|title=.DCX File Extension|publisher=fileinfo.com|date=2010-02-19|access-date=2014-03-14}}</ref>
Line 63 ⟶ 64:
# (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.{{Clarify|date=January 2015}} The header is
{| class="wikitable"
|-
! Offset hex
Line 93 ⟶ 94:
| 03||3
| 1 byte
| The number of bits constituting one
|-
| 04||4
Line 158 ⟶ 155:
|}
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''.<ref name=":0">{{cite web|title=PCX Format|url=http://www.shikadi.net/moddingwiki/PCX_Format|date=2012-06-23|publisher=ModdingWiki|access-date=2014-03-14}}</ref>
===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
|+ Table B. PCX Image Data Arranged into Color Planes▼
{| class="wikitable"
|-
|align="center" width="60" rowspan="4"| Row 0
|align="center" style="background:#ffafaf;font-family: monospace"| R R R R R R R R R
|-
|align="center" style="background:#afffaf;font-family: monospace"| G G G G G G G G G
|-
|align="center" style="background:#afafff;font-family: monospace"| B B B B B B B B B
|-
|align="center" style="background:#cfcfcf;font-family: monospace"| A A A A A A A A A
|-
|align="center" rowspan="4"| Row 1
|align="center" style="background:#ffafaf;font-family: monospace"| R R R R R R R R R
|-
|align="center" style="background:#afffaf;font-family: monospace"| G G G G G G G G G
|-
|align="center" style="background:#afafff;font-family: monospace"| B B B B B B B B B
|-
|align="center" style="background:#cfcfcf;font-family: monospace"| A A A A A A A A A
|-
|align="center" style="height:64px"| Row 2 etc.||align="center"| ....
|}
When an image is less than 8 bits per pixel, each line is padded to the next even byte boundary.<ref name=":1" /> For example, if an image has 1 plane of 1-bit data (monochrome) with a width of 22 pixels, each row will be
▲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 Table B.
▲When an image is less than 8 bits per pixel, each line is padded to the next byte boundary. For example, if an image has 1 plane of 1-bit data (monochrome) with a width of 22 pixels, each row will be 3 bytes long, having 24 bits per row with 2 bits unused.
===Image data compression===
{{Unreferenced section|date=January 2024}}
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:
#
#
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
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?|date=January 2024}} on the processors it was originally intended for.{{Contradictory inline
The PCX compression algorithm requires very little processor power or
===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.
==References==
Line 212 ⟶ 209:
{{DEFAULTSORT:Pcx}}
[[Category:
[[Category:Filename extensions]]
|