Common graphic formats

Frequently Asked Questions regarding XnView (including Answers)

Moderators: XnTriq, xnview

User avatar
Drahken
Posts: 883
Joined: Sun Apr 10, 2005 4:29 pm

Common graphic formats

Postby Drahken » Wed Apr 13, 2005 8:22 pm

This is to answer some questions about the strengths, weaknesses, and usage of some of the more common image formats.

PNG:
PNG comes in 2 flavors, truecolor and indexed.

Truecolor PNG:
Should not be used on the web due to large file sizes. Great for archiving, master copies, or any other situation where perfect quality is more important than filesize. Has excellent compression for a lossless format (only exceeded by JPEG2000), excellent compatibility, good speed.


Indexed PNG (aka 256 color PNG, aka paletted PNG):
Best format for graphical images (images with sharp edges and large areas of solid color), and screenshots. Excellent compatibility, excellent filesize, great speed. Perfect for web use.

Note: There is a lot of confusion about whether PNGs are a good format to use on the web due to compatibility questions. These only arise with internet explorer, all decent browsers have full support for PNGs. In addition, MSIE -can- handle PNGs (both true color and indexed) just fine, the only problem is with alpha and gamma chunks. The only time most people need to think about alpha or gamma chunks is when dealing with transparency. PNGs have 2 different types of transparency; alpha transparency (allows for partial transparency and shadow effects), and single color (GIF-like) transparency. MSIE can handle single color transparency with no problems, but can't handle alpha transparency.
In short, stick to single color transparency or no transparency, and you'll be fine.

JPEG/JPG:
Should be used with photographic-type images, using with images that contain areas of solid color and sharp edges will result in "echos" and artifacts, plus a bloated filesize. Should -not- be used for archiving or master copy purposes since it is a lossy format (some image data is thrown away every time you save the image). Is best for putting photographic images on the web, as it results in a file approx 1/10th the size of lossless formats, but with little/no visible quality loss. Excellent compatibility, excellent compression for truecolor and greyscale images, excellent speed. One weakness of JPG is that it handles red very poorly.

GIF:
Should only be used on graphical images. Can be used on the web. Best choice for tiny images (approx 40x40px images or less), best format for animated images due to compatibility reasons. Excellent compatibility, excellent speed, good compression (although indexed PNGs are much smaller on any image over 40x40px).

Note about animation: There is also the flash/SWF format for animation, but most progs that can create SWF files are commercial. There is also MNG (a variation on PNG), but there are few programs that can read MNGs, and only a paltry handful that can create them.

JPEG2000:
A good choice for photographic images. Has both lossy (for better filesize) and lossless (for perfect quality) settings. Lossless JP2s are good for archiving and master copy purposes, their size tends to be noticeably smaller than truecolor PNGs. Lossy JP2s get the best balance of quality and filesize for photographic images out of all the available formats.
JPEG2000/JP2 files have 2 major problems: 1) Speed: JP2s take a long time to compress, and a long time to decompress. 2) Compatibility: No browser can view JP2s without a plugin. There are a handful of programs that can create JP2s, but many of these are commercial, and some of the freeware ones have limitations on the dimension of the image.

TIFF:
A lossless format that is no longer of much use. You can get most of the same features, plus better filesizes by using lossless JP2s or truecolor PNGs. The one advantage TIFF has is that you can have multiple "pages" within a single image. Should not be used on the web.
TIFF is a complex format with many options. You can choose from a variety of colorspaces (if you don't know what a colorspace is, don't worry about it), many different compression formats (The TIFF format itself (and most (all?) of the other formats mentioned here) is what's called a "wrapper". Wrappers bundle the information, but don't actually compress anything. Each format has one or more compression formats available for actually compressing the data.), and many color depths to choose from. This has made it very popular over the years for professional level photography and document imaging. It also creates compatibility issues. Most imaging programs claim TIFF support, but most of these can only handle certain types and features of TIFF. The basic types/features can be handled by any TIFF compatible prog, but you never know whether a prog can handle the more advanced features or not until you actually try it.
One other potential (but limited) advantage of TIFF is that it has slightly higher maximum color depth than other formats. Most max out at either 8bit or 24bit, both TIFF and PNG max out at 64bit. However, TIFF's 64bit is slightly better than PNG's 64bit because TIFF uses all 64 bits for color, whereas PNG uses 1/4th if it for the alpha channel. This is rather a moot point though, since the human eye can only percieve a number of colors approximately the same as a 24bit or 32bit image.

BMP:
A common format on windows. Lossless, truecolor or indexed, no compression to speak of (RLE is available, but doesn't compress much), poor compatibility on non-windows systems. Should NEVER be used on the web due to the MASSIVE filesize.

LWF:
Nearly identical to JPEG2000, but is a proprietary format owned by luratech.

DJVU:
Lossy format, good for images that contain both text and photos (think catalogs, comic books, etc). Can be used on the web, but requires a plugin to view in any browser. DJVU achieves good compression by splitting the image into layers. The bottom layer contains the photographic portion of the image, the second layer contains all the black lines and sharp edges, the top layer is like the second one but includes colors. The fact that the different types of data are sperated allows them to be compressed using different methods, this results in a good balance of quality and size. DJVU also includes the ability to have multiple "pages" in a single image. There are only about 2 or 3 programs that can create DJVU images.
You can download a copy of DJVU solo HERE, this is the only freeware prog I know of that can create DJVU files.

LDF:
Nearly the same as DJVU, but is a proprietary format owned by luratech. Several programs can create LDF images, but most limit the number of "pages" you can have.

DJVU and LDF both result in a rather odd mix of blurrinees and sharp edges at high compression, see this example: http://allspark.net/cypherswipe/cover-LDF.png (example is a lossless PNG of the LDF, since browsers can't display DJVU and LDF files) Here's the original PNG so you can see exactly what high LDF/DJVU compression does: http://allspark.net/cypherswipe/cover-color.png


A note about progressive and interlaced images:
Both PNG and GIF formats have the option to create an interlaced image. Both JPEG and JPEG2000 formats include a similar option to create progressive images.
The filesize of an interlaced image will usually be noteably larger than that of a non-interlaced image. The filesize of a progessive image will usually be noteably smaller than a non-progressive image (unless the image is VERY large, then non-progressive will usually be smaller). Choosing interlaced/progressive has no effect what-so-ever on the quality of the image. PNGs/GIFs/lossless JP2s are always lossless, and JPGs/lossy JP2s do not lose more nor less quality because of the progressive option. The only affects interlaced/progressive have are a small change in filesize, and the way the image displays as it's loading.

A note about lossY and lossLESS formats/settings:
LossLESS formats will never lose data when you save them. (GIFs and indexed PNGs will be reduced to 256 colors -before- saving, but are otherwise lossless.)
LossY formats throw away some data every time you save them (this does not include downloading them, or saving them from a website, only when you open them and then save them from within an image editor). This data is usually not visible to the human eye (unless you set the compression level too high). However, this is not a good choice for an image that you plan to reopen/edit/resave often, since it will throw away more data each time.

Some examples of photographic images vs graphical ones:
Graphical:
http://allspark.net/cypherswipe/real-fantasy.png
http://allspark.net/cypherswipe/dragonsbane.png
http://allspark.net/cypherswipe/wise-ass-sig.gif
http://allspark.net/cypherswipe/SK-hawk03.png
http://kmeleon.sourceforge.net/gfx/kmelogo.gif

Photographic:
http://allspark.net/cypherswipe/spideygrab.jpg
http://allspark.net/cypherswipe/thunder-tiger-1.jpg

Some images can be hard to tell which they should be. In these cases, you just have to rely on trial and error. Examples:
http://allspark.net/cypherswipe/IoDsigSM.jpg
http://allspark.net/cypherswipe/SK-hawk01.png



Be sure to check out my related FAQS: What format should I use? ... Common image formats ... Lossy vs lossless vs color reduction


If you have a an improvement suggestion for this (or any of my other FAQs), or an additional question you think should be added, feel free to message me.

User avatar
Olivier_G
XnThusiast
Posts: 1423
Joined: Thu Dec 23, 2004 7:17 pm
Location: Paris, France
Contact:

Postby Olivier_G » Tue Aug 01, 2006 3:45 pm

I still don't agree with your TIFF description: TIFF is widely used by photographers and other professionals for the following characteristics:
- TIFF without compression is extremely well handled and widespread
- TIFF handles 8 bits and 16 bits (ie: 48 bits colored RGB images for example).
- TIFF support ICC profiles (and can support IPTC and other metadata with a few applications).
- TIFF uncompressed requires almost no CPU resource on compression/decompression.

It has become the format of choice for demanding photographers working on 16 bits (which generally means '16 bits precision', ie: 48 bits in RGB color), be it for intermediate working files or for sending high-quality images.
Olivier

User avatar
Drahken
Posts: 883
Joined: Sun Apr 10, 2005 4:29 pm

Postby Drahken » Tue Aug 01, 2006 5:40 pm

Olivier_G wrote:- TIFF without compression is extremely well handled and widespread

PNG is well handled and well spread, compressed or not.

- TIFF handles 8 bits and 16 bits (ie: 48 bits colored RGB images for example).

PNG handles 48 and even 64 bits.
- TIFF support ICC profiles (and can support IPTC and other metadata with a few applications).

PNG supports ICC, not sure f it can handle ITCP or not.
- TIFF uncompressed requires almost no CPU resource on compression/decompression.
Same is true of PNGs with compression set to 0.
Oh the feuhrer, oh the feuhrer, oh the feuhrer's nipples bonk!

User avatar
Olivier_G
XnThusiast
Posts: 1423
Joined: Thu Dec 23, 2004 7:17 pm
Location: Paris, France
Contact:

Postby Olivier_G » Tue Aug 01, 2006 6:04 pm

Drahken wrote:PNG is well handled and well spread, compressed or not.
PNG handles 48 and even 64 bits.
My point was about having all those desired features at the same time, of course...
Managing 16 bits/48 bits PNG is quite a challenge already. For example, I use RawShooter, NeatImage (PNG is not even listed for both of them) and Picture Window Pro which can handle 16 bits TIFF with ICC but not PNG in 16 bits.
Really: PNG is nowhere near TIFF in use in the photography community. Nor is JPEG2000 for other reasons...
Olivier

User avatar
DOS386
Posts: 291
Joined: Sun Jun 11, 2006 2:43 pm

Postby DOS386 » Thu Aug 28, 2008 3:08 am

Some hints / corrections:

- TIFF is IMHO useless, as Drahken already wrote

- Truecolor PNG supports 8 bits per channel or 16 bits per channel ... thus RGB -> 24 or 48 bits total per sample, or RGBA -> 32 or 64 bits total per sample

- "compatibility" issues on PNG are just unjustified, or obsolete at best

- Size complaints about PNG are mostly unjustified, only bad software produces bloated PNG's

- Lossless JPEG2000 is IMHO useless - only very marginally better than PNG at best, but unusable compatibility and license

- Lossy JPEG2000 - indeed better than JPEG, but unusable compatibility and license

- For tiny images up to 40x40 - GIF better than PNG ? Maybe you should reduce a bit :shock: { - this "shock" smiley zoomed up from 15x15 to 30x30 : NN algo - > GIF: 300 Bytes PNG: 244 bytes | Lanczos algo - > GIF: 414 Bytes PNG: 424 bytes

- SWF good format for animations ? Horrible and "expensive" format ...

- Photo community prefers TIFF over PNG ? Possibly true, but no reason ...
There is indeed no WinZIP under my rock.

User avatar
Troken
Posts: 696
Joined: Thu Feb 09, 2006 10:18 am
Location: Sweden

Postby Troken » Thu Aug 28, 2008 8:14 am

Aha, TIF-users vs PNG-users, wonderful! :)

:arrow: Drahken and DOS386
TIF is certainly not a useless or "dead" format, this is not true and is the statement is in mho even misleading. I assure you, it is very much used, although it is an old format. I work proffesionally with illustration, graphic design and prints, to a large extent working with books and printed material. When it comes to the printing business, very few would use PNG for ie. a book.

Olivier_G mentioned some of the following already: TIF is one of the most commonly used formats for prints and images using CMYK. All printing houses I've ever been in contact with prefers TIF, EPS, PDF or PSD when it comes to high-res CMYK:ed images (or other colorspaces). Add the features lossless quality and ICC-profiles, essential for many projects! It would be unusual to present material in PNG, even if it could be accepted (along with JPGs), BUT you have to know how you use it.

And the usage of ICC-profiles should not be underestimated, it also is a essential tool when working with high end imagery, so I understand the that the format is widely spread along photographers and photo retouchers too. (Explains why I've been so engaged about ICC in this forum :) ) As far as I know PNG does not support ICC-profiles, but plz correct me if im wrong. Note: Lately RAW is getting more popular for photographers.
(EDIT: I noted that Drahken mentioned that PNG does in fact support ICC.)

Another extremely great feature with TIF is layers, which not many formats support (only native photo editing program formats, i.e. PSD of Photoshop).

Im not trying to say that PNG is a inferior image format, I dont have any personal favorites when it comes to image formats, they are just tools. But to be realistic, PNG it is not as widely accepted in the printing business. Still, it was very interesting reading that PNG is so useful, many really nice features I was not aware of. Does PNG support IPTC and paths too?
Last edited by Troken on Thu Aug 28, 2008 8:17 am, edited 1 time in total.

User avatar
Peter2
XnThusiast
Posts: 1093
Joined: Thu Nov 24, 2005 3:07 pm
Location: CH
Contact:

Re: Common graphic formats

Postby Peter2 » Thu Aug 28, 2008 8:15 am

Drahken wrote:...
TIFF:
... plus better filesizes by using lossless JP2s or truecolor PNGs. ...

To you compare the filesize with a compressed or an uncompressed TIF?

Peter
XnView 2.40 German, Win 7 x64 Prof. / Win 10

User avatar
Troken
Posts: 696
Joined: Thu Feb 09, 2006 10:18 am
Location: Sweden

Postby Troken » Thu Aug 28, 2008 3:25 pm

Reading a little about formats on the web, this sentence pretty much says it all (source: Wikipedia):

PNG was designed for transferring images on the Internet, not professional graphics, and so does not support other color spaces (such as CMYK).


But after reading more about PNG, I think I'll go from JPG to PNG when it comes to web and screen imagery. Why are all images on the internet still JPG?

User avatar
XnTriq
Moderator & Librarian
Posts: 4904
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Postby XnTriq » Sun Aug 31, 2008 12:00 am

Tagged Image File Format (TIFF)

QuarkXPress, InDesign, Photoshop and Photo-Paint have read & write support for vector clipping paths in TIFF files.
Portable Network Graphics (PNG)

libpng.org (A Basic Introduction to PNG Features) wrote:Like GIF and TIFF, PNG is a raster format, which is to say, it represents an image as a two-dimensional array of colored dots (pixels). PNG is explicitly not a vector format, i.e., one that can store shapes (lines, boxes, ellipses, etc.) and be scaled arbitrarily without any loss of quality (generally speaking). For that you probably want SVG or PostScript. (There are some private extensions to PNG that add vector information in addition to PNG's regular pixels — Macromedia's Fireworks does something along those lines — but no valid PNG may omit the pixel data.)

Private chunks” in Fireworks PNG files: prVW, mkBF, mkBS, mkBT, mkTS.

Wikipedia (Portable Network Graphics) wrote:Adobe Fireworks (formerly by Macromedia) uses PNG as its native file format, allowing other image editors and preview utilities to view the flattened image. However, Fireworks by default also stores meta data for layers, animation, vector data, text and effects. Such files should not be distributed directly. Fireworks can instead export the image as an optimized PNG without the extra meta data for use on web pages, etc.

User avatar
RGBA
Posts: 45
Joined: Fri Jul 18, 2008 10:41 am

Postby RGBA » Sun Aug 31, 2008 10:26 am

Ah, XnTriq added a few more infos.
I was a bit away and wanted just complete this with this details.

It really depends on: where you work or what you do!
Web Designer with dominated Screen-Output using PNG, also ICON Retailers.

But if you ever worked for a printing company you know why TIFF is heavenly
and its even better as PSD, when we compare the compression.

I only agree its an old spec., but gold - you need it, you use it.
Its next to EPS and PDF one of the most used filetypes for works with CMYK.
By the way, old is not always bad. :wink:

Here an important value compared

PNG
Layers: 3+1 Alpha

TIFF
Layers: 1,3 or 4 Color, 20 Alpha


Return to “XnView - FAQ”

Who is online

Users browsing this forum: No registered users and 1 guest