PCX
From Wikipedia, the free encyclopedia
PCX | |
File extension: | .pcx |
---|---|
Developed by: | ZSoft Corporation |
Type of format: | lossless bitmap image format |
PCX is an image file format developed by the ZSoft Corporation of Marietta, Georgia, USA. It was the native file format for PC Paintbrush, introduced in 1985, one of the first popular DOS graphics programs for early PCs.
The PCX format supports simple data compression and was quite common on early DOS and Windows systems. Direct competitors of PC Paintbrush, as Electronic Arts's Deluxe Paint II Enhanced, employs it.
In fact, it was one of the first widely accepted de facto DOS imaging standards, because it is a device-independent file format: the horizontal and vertical resolution, pixel color depth and number of colors of the image are all definible. Former painting software typically dumps the contents of the display's video buffer to plain raw files (for example, John Bridges' PCPAINT .pic files), making them device-dependent (i.e., screen resolution and color depths, scan lines and bit planes arrangements are all hardware specific).
Also, its data compression feature was then very appreciated, and a factor of success, due to image files usually takes important amounts of RAM memory and disk space. But is nowadays rare, having been largely replaced by formats which support better compression ratios, such as GIF, JPEG and PNG.
[edit] Typical file format
Most PCX files use a 2, 4, 16 or 256 color palette, but the format has also been extended to allow 24-bit images. It also supports various aspect ratios to adapt the images to different display monitors (graphical modes for CGA, Hercules, EGA and VGA PC video cards have different aspect ratios).
The compression algorithm is the Run-Length Encoding (RLE), a simple algorithm which collapses series of three or more consecutive bytes with identical values into a counter-value byte pair. The implemention in the PCX file uses the 7th bit of a byte as a flag that indicates if the byte is a counter or a pixel value. If the bit is 1, the remaining bits store the counter value, from 3 to 127, and the following byte is the pixel value that is repeated. But when the pixel value is in the range 128...255 (that is, its 7th bit is already on), it must be preceded with a fake byte counter when it only occurs one or two consecutive times in the stream, i.e. resulting in that the counter value is just 1 or 2.
Because pixel values 0..127 are compressed better than values 128..255, good palette sorting is important (due to the fact that pixel values are the palette entries indexes). It is usually (but not always) enough to move the most-common colors into palette positions 0..127, and least-used to palette positions 128..255. Obviously, this is only possible if the color palette is not to be shared among different images (a common palette or master palette), or has fixed colors at specific indexes (as those used by an application to display its user interface elements). When palette sorting could be applied (by simply counting the times every color appears on the image pixels array), this is warranted to produce better results, and optimal when the image is not dithered.
This compression algorithm is very fast and takes very little memory, but is not very efficient, making it impractical for compressing photographs and more detailed computer graphics.
[edit] External link
|
||||
---|---|---|---|---|
Video compression formats |
|
|||
Audio compression formats |
|
|||
Image compression formats |
|
|||
Media container formats |
|