Recent Changes - Search:

Recently Written

News

edit SideBar

GraphMediaTech

See Compress about general info on data compression.

For painting programs, see GraphPaintCAD .

1.  Image formats - raster vs vector

There are 2 types of image formats: raster formats AKA pixel formats (BMP, PNG, JPEG, …) and so-called “vector formats” (SVG, WMF/EMF, and all CAD-style formats).

Within category raster images there are many image file formats available, uncompressed, losslessly compressed and lossilly compressed ones. Some provide transparency or animation.

2.  Colorspaces, bitdepth and gamma

(!!writeme!!)

3.  Some popular or useful file formats

3.1  BMP

The simplest one ( BMP = BitMaP ). Mostly uncompressed, binary (black & while), indexed/palettized (16 or 256 colours), or TrueColor (2^24 colours, RGB), a RLE compression is defined but almost never used. Strange: fills the image from the bottom to the top ! Related to “Windows GDI” , structures are shared between BMP files, GDI, and “bitmap resources” in NE and PE executable files. There are also 32-bit BMP’s around, but it is not well defined how to use the “additional” 8 bits in every pixel, they can be used for transparency (Alpha, as in PNG), but they can also contain just garbage (typical source: screenshooting 32bpp screens) and make the BMP look strange/broken if the viewer supports BMP transparency.

More technical info/spec: http://wiki.multimedia.cx/index.php?title=BMP

3.2  TIF, TIFF

Reportedly used mostly by “professionals” - very complex, many lossless and lossy compression methods defined, but rarely used, actual usage is in fact similar to BMP - for uncompressed images, to expose the uncompressed size. Hardly any benefit over BMP, PNG or JPG, except you badly need some of the features exclusive to this format, like other than RGB colorspace or multi-page.

3.3  PCX

Old, considered as “badly designed”, binary, indexed/palettized or TrueColor, also some “special” formats for “planed” VGA modes. Optional RLE compression.

3.4  GIF

A quite old format ( GIF = Graphics Interchange Format ), mostly compressed using LZW84 algorithm, had big problem because of the LZW84 patent (see link below, also so called “ LZW-free ” GIF’s were around for some time  :-D ) , now patent is expired, but GIF format obsolete, indexed/palettized, 256 or less colours, no True colour (somewhat “possible” with “hacked” GIF’s, but non-standard, abusing badly designed “GIF89″ format enhancements, inefficient and useless), allows animation (not yet obsolete). See burnallgifs.org about the patent and alternatives for LZW84 and GIF - content now “archived”, but still available).

3.5  PNG

About, features

Preferred open and unpatented image file format ( PNG = Portable Network Graphics ), supporting lossless compression using Deflate algorithm, optionally with some “delta”-based filters, 2, 16, 256 or True (2^24) colours, transparency (transparent index or full Alpha channel), and even 16 bits per colour component (grey, RGB or RGBA), although latter is rarely used and some programs don’t support it. The only supported colour model is RGB.

Animation trouble

GIF format supports animation, PNG doesn’t. Thus 2 competing “enhancements” for animation have been defined:

  • MNG - old but not popular, crucial design decision: MNG is NOT the same as PNG - different purpose, different file format, PNG-only decoders will reject it. This is the official one defined by the PNG developer team.
  • APNG - new, viewing support (non-DOS) in latest versions of Opera, Firefox and XNview, PNG-only decoders will see 1 frame, but the PNG developer team rejected this idea.

Compression

The design goal of PNG was, besides avoiding the patented LZW84 algorithm, to provide better compression than GIF. What should be noted, however, is that the compression is adjustable and optional, so uncompressed PNG’s are possible as well (hack: use uncompressed < 64 KiB blocks as defined in Zlib/Deflate standard, useful with MPLAYER (frame decomposition, uncompressed is default), and MENCODER, see Video ), and that all the graphics programs/converters do significantly vary in compression quality - some of them are bad and produce unnecessarily big PNG’s. There have been and are ideas around to add some more compression algorithms to PNG (RLE - cheaper, LZMA - stronger, Dirac lossless - very very best (??) ), but nothing has happened so far so Deflate is the only choice for now.

Usage

PNG format is suitable for screenshots, logos, graphs, technical images, photography (if all details have to be kept at the cost of bad compression). Since its introduction, the popularity of PNG has been slowly growing. Since cca 2000 all browsers do support this format and now (2012), it is very common for all sorts of images in the Internet, except photographic ones. PNG images can be found, besides other formats, inside DOC, DOCX and ODT documents, and the PNG compression (but not the full file format) is also part of PDF document format (besides other compression algorithms), see also DocumentFormatsViewers.

DOS support

Several DOS viewers (all needing at least 80386) do have PNG support, although some are buggy and abandoned, some work well, some of course don’t support PNG, no known solution for < 80386 CPU, see GraphPaintCAD . PNG creation and optimization is available as well, see below. Alpha channel feature isn’t supported in Arachne (see Browsers ). Support for MNG is unknown, for APNG there are at least “apngdis” and “apng2gif” , see below.

More info

3.6  JPG, JPEG

About

A very popular (many people do not know anything besides JPG and consider JPG as synonym of “picture”  :-D  ) and surprisingly also quite obsolete (see below) lossy format. “JPG” is the same as “JPEG”, and pronounced like “Jay P’Egg”.

Technical details, loss

Actual use covers a subset only (!!!) of “original” standard, for example the lossless variant (!!!) or using arithmetic coding instead of Huffman didn’t become popular at all, so-called “progressive” variant is supported by most decoders but pretty rare. Includes lossy compression (always and “only” lossy, “lossless JPEG” exists (only the “outermost” file structure is shared with the “standard” JPEG, compression algorithm is completely “exchanged”) but you will run into trouble with it → use PNG format for lossless !). Compression uses RLE and Huffman, preceded by separation of the colour data from the brightness (RGB → YUV/YCbCr), optional subsampling, some “crucial” transformations (DCT) and truncating (“quantization”). The amount of truncating can be varied and affects the compression (the more truncating, the better the compressibility and bigger the loss). The JPEG compression is most useful “in the middle” of the range where the compression is significant and the loss acceptable. High and “highest” quality settings (frequently referred as “100″ or even “100%”) will minimize the loss, but not avoid it completely, and hurt the compression, making it comparable to PNG or even worse, so using PNG can be a better option then. The very low quality settings can make the file once more significantly smaller, but it will look very bad, having much noise and blocking well visible, so zooming down would be an alternative if you must reduce the file size that much. The JPG compression [ab]uses the fact that the human eye has a much worse resolution in colours than in brightness and affects the quality of weak contrast details, especially the coloured ones, similarly as classical TV systems (PAL/SECAM). The image looks well from a distance, but terribly if you focus on details.

Usage

Photography, previews of paid content (poor quality as “feature”), part of PDF document format (besides other compression algorithms), see also DocumentFormatsViewers.

Space for improvements, end of life ??

The format can be considered as obsolete, because the are a few lossless archiver compressors (including latest versions of WinZip), trying to recompress JPG’s and the vendors / maintainers are reporting success about achieving up to 30% save. Compressing first with loss and later lossily (and even later undo these 2 steps, having to recreate the Byte-identical “original” JPG file) is quite a nonsense and the “time has come” to replace JPG with a new image format offering better compression. There have been ideas and attempts around, but none of them had any usable degree of success so far. JPEG-2000 failed here (see below), JPEG XR (was WMP) is no option either (see below), idea to use the “wavelet” algorithm from Dirac video codec (see Video ) didn’t come too far, latest chance is WebP (see below) promoted by Google.

3.7  JPEG-2000 , JP2

An almost unknown image format, offering both lossless & lossy compression, in this respect technically superior to JPG. Unfortunately it is highly proprietary (“LuraTech” company) and very restrictively licensed. Compressing images to JP2 and uploading them to the Internet is not possible not only because without an expensive license the usage is limited to “personal evaluation” only, but also none of existing popular web browsers supports it. Finally, the algorithm is quite complicated and consumes much CPU performance. Supported inside PDF, but apparently not really used there either. See above (JPG) for alternatives.

3.8  JPEG XR (previously known as WMP and HDPhoto)

http://en.wikipedia.org/wiki/JPEG_XR

This is the “new”  :-(  image “standard”, introduced in 2006 by Micro$oft. It is/was, as common with Micro$ofts inventions and known from WMA and WMV, a closed standard, includes DRM (optionally), some docs are published, but they are incomplete, and the complete information is available only to trusted companies at high cost and a restrictive license. Now “open”, one can buy book with full spec (??). It supports both lossless and lossy compression and compresses (reportedly) much better than JPG, see above (JPG) for alternatives. DOS support is unknown (NCONVERT plugin).

3.9  WebP

http://en.wikipedia.org/wiki/WebP

Format introduced by Google in 2011, derivative of VP8 video codec. Lossy image compression, attempt to replace JPG, but it’s controversial whether it’s really superior. In 2012 lossless compression was introduced, with optional transparency, as an attempt to replace PNG. Early tests showed it to be extremely slow. NCONVERT 5.91 does support it (only lossy, DLL needed), there are also “cwebp” and dwebp” (see below), the preferred tool to decode WebP in DOS is Image Worsener , the Win32 binary works well with HX. Note that some early WebP files are no longer accepted by later library versions and binaries compiled from them.

Examples:

3.10  NETPBM PPM/PNM/PAM & Co (“P1″ to “P7″)

http://wiki.multimedia.cx/index.php?title=Netpbm

Trivial uncompressed “raw” formats (partially even using ASCII numbers), used primarily on Linux as replacement of BMP which isn’t appreciated too much there.

  • “P1″ to “P6″ older, supported by some DOS viewers
  • “P7″ AKA PAM newer, supports 16bppc and Alpha, but no known DOS viewer

3.11  EMF/WMF and SVG

… so called “vector formats” (as opposed to pixel formats)

4.  Programs

4.1  Animated GIF

4.2  APNG

Programs by MaxSt

Misc

(no way to view APNG in DOS, but at least frame decomposition or conversion back to AGIF)

4.3  PNG optimizing

http://www.bttr-software.de/forum/board_entry.php?id=13478 (WOLF & Co)

Common notes:

  • Many optimizers don’t support APNG / animation (they may warn, or just silently ignore additional incoming frames)
  • Some don’t support transparency (they may silently remove it)
  • Most don’t support 16 bits per channel (but it’s very rarely used, and there is little point to optimize such files)
  • Most do support other formats (BMP, GIF, JPG, TIFF) as input, but only the most common flavours of those formats, the support is “incomplete”, in such cases, try NCONVERT to convert into BMP or not optimized PNG before feeding into optimizers

PNGOUT

PNGOUT is a commandline utility used to compress or recompress images written by Ken Silverman , closed source freeware, using the same strong algorithm (+ PNG-specific optimizations) as eir KZIP product. It supports BMP, GIF and PNG as input formats and outputs PNG. It is optimized for strong compression, therefore a bit slow and memory hog. It compresses better than most graphics programs, it does make sense to recompress PNG’s also, they mostly can be made smaller by cca 1% … 20% with no loss. GIF’s can shrink even more, by cca 5% … 50%. PNGOUT can’t undo its work - convert PNG into any other format or the new PNG into the original (bigger) one, except you “push” it to use a suboptimal filter. Recently author’s focus moved on the “PNGoutWin” product, Win32 GUI payware. Reportedly it uses the “same” compression algorithm as PNGOUT, but tests showed that it does some additional compression effort not available in PNGOUT.

OPTIPNG

Open source PNG optimizer, brute-forces through ZLIB and LIBPNG (“filter”) options, resulting in better PNG’s than most other programs. Needs HX, beware of “LFN-problem”, see HX compatibility lists .

Project page: sf.net/projects/optipng

PngOptimizer

BMP / GIF / TGA to PNG conversion, AGIF to APNG conversion, PNG optimization, APNG optimization

TruePNG

PNG Optimizer by x128@ua.fm , last update version 0.6.2.2 - 2016-Apr-03, freeware, closed source, manual not included. Looks promising, and it’s “moderately slow” only. Can optimize transparent PNG’s without damaging the transparency, and apply lossy effects, among other reduce to more than 256 colours. Needs HX, see HX compatibility lists .

Bugs:
  • (FIXED ??) Only PNG is supported as input format. Feeding in anything else will not throw a useful error message, but hanging or crash.
  • (??) It crashes on (rare) Grey+Alpha images.

Result comparison

For palettized images, PNGOUT is almost always better, OTOH for TrueColour ones OPTIPNG is sometimes (rarely) the winner. PngOptimizer seems to be inferior in compression, but it supports APNG too (PNGOUT and OPTIPNG don’t).

4.4  WebP

CWEBP and DWEBP official binaries. Somewhat usable but trouble:

  • versions < 0.41 are no longer available
  • some old WebP files decode with 0.21 but no longer with >= 0.41
  • <= 0.50 need P3 processor (use ImageWorsener instead, see below)
  • 0.51 needs P4 processor
  • one missing import, ignoring helps mostly
  • 0.51 crashes at exit but work done
  • preferred and default alternative input and output format is PNG, but it’s “supported” only through “WIC” AKA “Windows Imaging Component”

4.5  Image editing + format conversions

NCONVERT

NCONVERT is a commandline utility used to convert and edit images, written by Pierre E. Gougelet , related to eir XNVIEW (Win32 GUI) product. The fairly recent versions 5.00 and 6.88 do support DOS again, also using the Win32 one via HX is possible, but 3 bad hacks were needed for versions <=5.05, only one (ignore missing imports) is sufficient for versions >= 5.06 . It is closed source but free for personal use. It can compress, decompress and convert a huge amount of image file formats, perform effects, adding text is not available in DOS. Also decomposition of animations into frames is possible, but limited: only “differential” frames will be provided if the animation uses such (“optimized” animation), and for APNG the result may be garbage in some cases. For AGIF thus GIFSICLE is a better choice, for APNG there is APNGDIS (see above). The chief drawback is that it internally uses only 8 bits per color component (instead of 16), this reduces memory requirements and improves the speed, but increases the quality losses, also it doesn’t handle the “Gamma” correctly.

ImageWorsener

Somewhat similar to NCONVERT, but focuses more on quality than on performance or supporting many formats.

ImageMagic

“commandline Photoshop” compiled by Blair : ibiblio.org/…/magick


5.  See also

Edit - History - Print - Recent Changes - Search
Page last modified on August 14, 2016, at 07:22 AM