Photo Image File Formats, TIF, JPG, PNG, GIF. Which To Use?

JPG is the image file format most used. JPG is the file extension for JPEG files (Joint Photographic Experts Group, a committee of ISO and ITU). Digital cameras and web pages use JPG files, because JPG heroically compresses the data to be very much smaller in the file. JPG uses lossy compression to accomplish this feat, which can have a strong downside if overdone. Yes, there is nothing like JPG for small, but that is at the risk of reduced image quality.

This JPG compression risk degree is selectable (with an option setting named JPG Quality in your editor seen as you save the file). High Quality means lower JPG compression for higher quality larger files. Or you could choose a Lower Quality, to be higher JPG compression for smaller files but lower image quality. Small file size and high image quality are opposites. Your digital camera offers that size choice too, the menu usually called Image Quality (you do of course want to select best quality in the camera). In general today, JPG is rather unique in this regard, of using lossy compression allowing very small files of lower quality, whereas almost all other file types use lossless compression (with larger files). The meaning of Lossy and size is discussed more on another page at JPG Artifacts.

Greater JPG compression is used when small file size (for email transfer or web pages, memory cards, etc) is more important than best image quality. You will have to decide if smaller file storage is more important than a larger better quality format that might be important archived for a later time (storage space is inexpensive today). A High Quality setting to create JPG is good enough in most cases, if we don't overdo the compression. Perhaps good enough for some uses even if we do overdo it (web pages, etc). But if you are concerned with maximum quality for archiving your important images, then you do need to know two things: 1) JPG should always choose higher Quality and a larger file, and 2) do NOT keep editing and saving your JPG images repeatedly, because more quality is lost every time you save it as JPG (in the form of added JPG artifacts ... pixels become colors they ought not to be - lossy). More at the JPG link at page bottom.

To prevent continued edits from adding JPG artifacts, keep edits in a TIF format until time to create a final JPG, and perhaps archive that TIF file too, for any future use. Writing a TIF file will NOT remove any existing JPG artifacts from the image, but it will not add any more of them. This need will be recognized as quite important after you have failed to do this for some important image you needed again, but didn't have. The camera will do one JPG Save (if not Raw) and the final JPG file for use will do another, but using the TIF file for all edits limits that to only those two JPG Saves. I don't necessarily mean EVERY image, since we do shoot a lot of junk never to be seen again, but I mean those obviously good and important images that you conceivably might want again in the future. Prepare them for that and save their fate.

JPG2 There is a format called JPG 2000 with .jpg2 files. It uses a different compression without the JPG artifacts, but its blur typically reduces image sharpness. Little used, and few programs support it, so it is likely incompatible with most programs. Web browsers don't show JPG2 files.

  • TIF is lossless (including LZW compression option), which is considered the highest quality format for commercial work. The TIF format is not necessarily any "higher quality" per se (the same RGB image pixels, they are what they are), and most formats other than JPG are lossless too. TIF simply has no JPG artifacts, no additional losses or JPG artifacts to degrade and detract from the original. And TIF is the most versatile, except that web pages don't show TIF files. For other purposes however, TIF does most of anything you might want, from 1-bit to 48-bit color, RGB, CMYK, LAB, or Indexed color. Most of the "special" file types (for example, camera RAW files, fax files, or multipage documents) are specials based on TIF format, but with unique proprietary data tags — making these incompatible unless expected by their special software. Web browsers typically cannot show TIF files (the uncompressed size is greatly larger than JPG compression).

    TIF format is very versatile. There are many TIFF formats for all kinds of data and compressions. CCITT data for standard text document storage, which supports multiple pages in one file. Standard fax is another TIFF format. Designers can be assigned special data tags to declare other data and compression types. One case is that some camera Raw files are actually TIF format, but with unique proprietary data tags for their special purpose, which then is no longer compatible with TIF viewers.

  • GIF was designed by CompuServe in the early days of computer 8-bit video (1987), before 24 bits or JPG was available, for video display at dial up modem speeds. GIF discards the printing resolution value, and all EXIF data, because GIF was designed for video screen purposes. GIF always uses lossless LZW compression, but it is always an indexed color file (1 to 8-bits per pixel). GIF can have a palette of 24-bit colors, but only a maximum of 256 of them (which colors depend on your image colors). GIF is rather limited colors for color photos, but is generally great for graphics. Repeating, don't use GIF for color photos today, the indexed color is too limited for full color. And if printing a GIF, you will have to specify resolution and size, because GIF discards any dpi info. GIF does offer transparency and animation. PNG and TIF files can also optionally handle the same indexed color mode that GIF uses, but they are more versatile with other choices too (which can be RGB or 16 bits, etc). But GIF is still very good for web graphics (i.e., with only a few colors). For graphics of only a few colors, GIF can be much smaller than JPG, with more clear pure colors than JPG, but many fewer colors). Indexed Color is described at Color Palettes.
  • PNG can replace GIF today (web browsers show both), and PNG also offers many options of TIF too (indexed or RGB, 1 to 48-bits, etc). PNG offers an 8-bit mode to replace indexed 256 color GIF files, or a 24-bit mode for a possible 16.78 million colors for photos. At time of creation, these modes are often described with the nomenclature of PNG8 or PNG24. All PNG does offer lossless compression, but not as dramatically small as lossy JPG. PNG was invented more recently than the others, designed to bypass possible LZW compression patent issues with GIF (which never actually became an issue). And since PNG was more modern, it offers other options too (RGB color modes, 16 bits, etc). One additional feature of PNG is transparency for 24 bit RGB images. Normally PNG files are a little smaller than LZW compression in TIF or GIF (all of these use lossless compression, of different types), but PNG is a bit slower to read or write, and is larger files than JPG. That patent situation has gone away now, but PNG remains excellent lossless compression. Less used than TIF or JPG, but PNG is another good choice for lossless quality work.
  • Camera RAW files are very important, but RAW files must be processed into regular RGB formats (JPG, TIF, etc) to be viewable and usable in any way. Make no mistake, Raw described at Shooting Raw is a philosophy, not just a setting. RAW involves a little extra work, which is easy, and great tools are available, which then offers substantial benefits, one of which is we can choose our White Balance settings AFTER we can actually see the image, and see what it needs, and see what helps it, and can still change our minds and try something else. Can tweak exposure too. And Raw has lossless editing, meaning the original raw file is retained and can be easily recovered. Some may debate Raw, but many cannot imagine NOT taking advantage of the greater opportunities of RAW. Others think any extra step is too much trouble, and are satisfied with JPG — but my own biased opinion is they just don't know yet, or don't care. 😊 Raw is about caring. If you care about best image quality, you will really love how easy Raw can achieve it. But if you're already satisfied with the pictures you get, Raw won't be of interest. More Raw detail Below.

    We could argue that there really is no concept of RAW files from the scanner (scanner images are RGB, not raw). Vuescan does offer an output called RAW, which is 16 bit, but is still RGB, not raw like from cameras. The difference is that that option only defers gamma correction encoding until a later pass. And its file can include the scanners fourth Infrared noise correction channel data if any. Vuescan itself is the only post-processor for these Vuescan raw files (except any Photoshop-like Levels control can adjust gamma). But scanner color images are already RGB color, instead of Bayer pattern raw data like from cameras.

    Camera RAW images are not RGB, and must be converted to RGB for any use (our monitors and printers expect RGB images). The idea and big advantage of camera raw is that all camera and JPG processing options (such as white balance and contrast) are deferred until later, when we can see the image to decide what it precisely needs without having to undo JPG processing. That makes it better, and much easier to get it right. Then the converted RGB image can be saved only one time as high quality JPG (no JPG artifact issues). When and if the image needs additional processing, we discard that JPG copy and resume from the raw archive original.

    I strongly recommend always archiving your original unedited JPG image from camera or scanner. If you have made changes, that's the only way to get the original JPG data back. Especially for JPG, archive the first pristine copy (but camera Raw files are not editable, so they are always pristine unless you delete them). Your download folder should be your permanent archive location of the camera's unchanged original file, and edited copies go elsewhere. Good practice is when editing that image, always save any change to a different file in a different location, always, preferably to a TIF file. Never overwrite or delete your only camera original file. Always keep that pristine original, because you can't otherwise go back. Because there could be times when you realize the edited image is damaged, especially important on the really special ones. JPG especially, each JPG compression is lossy. If you did edit that original JPG file a few times, for white balance, brightness, resampling or cropping, JPG quality suffers with each new JPG compression (lossy), and it is irreversible if the original image is lost. You can't go back, so don't risk destroying your pristine original image. Any work should only make a copy. Beginners tend to worry about the disk space used by that archive, but this is just the nature of the game, JPGs are small anyway, and disks are inexpensive (a 4 TB Western Digital USB 3.0 external drive is about $100 USD). Disk space becomes a trivial concern. Retaining your original image is not trivial. Make a frequent backup too, onto another disk. It's a choice of being safe now, or sorry later.

    A few features of common file types
    File PropertyJPG TIF PNG GIF
    Web pages can show itALLALLALL
    Uncompressed optionYes
    Lossy compressionALL
    Lossless compressionYesALLALL
    GrayscaleYesYesYesYes
    8-bit RGB color (24-bits)ALLYesYes
    16-bit RGB color (48-bits)YesYes
    CMYK or LAB colorYes
    Indexed color optionYesYesALL
    Transparency optionYesYes
    Animation optionYes

    The term ALL means it is the only option. Yes means it is an available option. Blank means there is no option.

    Different color modes have different size data values, as shown.

  • Từ khóa » X Png Gif