Results 1 to 8 of 8

Thread: difference gif - jpg

  1. #1
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    807
    Thanks
    87
    Thanked 2 Times in 2 Posts

    Default difference gif - jpg

    Hey you all,
    What is the difference between a gif and jpg ? Is there a difference in quality, loading, ... ?

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The largest difference is that JPEG uses a lossy compression format, while GIF uses a lossless. Thus, JPEGs can be compressed far more efficiently than GIFs, but at the loss of quality. The formula used to compress them, however, allows a variable amount of compression; the more the file is compressed, the smaller the filesize becomes, but the more the quality degrades.

    GIFs, on the other hand, support only one level of compression, the maximum. No degradation occurs, but the resultant filesize is (in almost all cases) significantly larger than that of JPEG. GIFs also support a basic form of transparency, but are limited to 256 colours. The latest versions can be animated.

    You didn't ask about this one, but it bears mentioning anyway: for almost all uses, PNG is preferable over GIF (now that IE supports it properly): it is also a lossless format, and supports proper alpha transparency, a superior compression algorithm, resulting in smaller filesizes (although note: Photoshop does not compress PNGs as far as is possible, and the filesize of such files may often be roughly the same; thus, it is recommended to use pngcrush or The GIMP if you're worried about filesize) and a modern number of colours. One disadvantage is the possibility that gamma correction problems will cause it to not match with the surrounding web page, but this can be avoided in all modern browsers by simply not saving gamma information in the PNG file. The only area in which PNG still lacks is animation. For animation, GIF is the only commonly-implemented file format with support. Another format, MNG, addresses some of PNG's shortcomings, adding animation support and even JNG, a form of JPEG with alpha transparency. However, it is currently very narrowly-supported.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    GIF is NOT lossless. That's silly. It limits it to 8-bit color.... 256 possible colors for the whole images. That's VERY lossy. Now, aside from that, it could be theoretically lossles... But.... no.

    JPG... best for photos, since it can have enough colors.

    GIF... best for graphics and images with just a few colors. This should be a lower filesize than JPEG and better quality, but only if just a few colors.

    GIF also can be animated as Twey said.

    PNG isn't completely supported, but seems to be for the most part. I really don't know that much about it. I've never done much with it. I guess nothing against it... should be fine.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    GIF is NOT lossless. That's silly. It limits it to 8-bit color.... 256 possible colors for the whole images. That's VERY lossy.
    Yes, but an image that can be represented by it isn't degraded That's the definition of "lossless." Compressing a JPEG image will always result in degradation of the image, no matter how many colours there are in it. In fact, even saving an existing JPEG again, with the same settings, will result in a loss of quality. This is the definition of "lossy:" the compression algorithm alters the original data. This does not occur with GIF: saving the same image again with the same settings will result in exactly the same image being output. The compression algorithm does not modify it.
    PNG isn't completely supported, but seems to be for the most part.
    PNG is very well-supported nowadays. IE was the last common browser to have problems with it, which have been fixed in IE7.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    PNG may still be a bit inaccessible... some photo editors might not support it, etc.
    But... sure, as I said, it's probably fine.

    With GIF... right... there's no degredation of quality between saves.
    However, that's not really true.
    Since it is specifically 256 colors, it stays as is.
    But if you add more colors to it, then the whole thing gets recompressed and recalculated, causing generation loss.
    It's too big a generalization to say "lossless" for GIF, though it may be true in specific circumstances. And, yes, JPG is always lossy, so it is more so than GIF.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33 View Post
    PNG may still be a bit inaccessible... some photo editors might not support it, etc.
    Then they probably aren't worth using. The first version of the PNG format was published just over a decade ago.

    With GIF... right... there's no degredation of quality between saves.
    However, that's not really true.
    Of course it is. Either there is degradation, or there isn't, and due to the lossless nature of the compression method, the latter applies.

    But if you add more colors to it, then the whole thing gets recompressed and recalculated, causing generation loss.
    That has nothing to do with lossy or lossless compression. These terms apply only to the compression algorithm, and that in itself doesn't cause data loss of any sort.

    Saving a GIF image doesn't cause colours to be lost: the image must already be an 8-bit, indexed image. If it isn't then the number of colours must be reduced, but these are separate operations.

    Mike

  7. #7
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    807
    Thanks
    87
    Thanked 2 Times in 2 Posts

    Default

    Fantastic conversation you are having !
    As my site contains lots of pictures (that's what artists do), I just wanted to see if there is a big difference, so to improve the quality of the pictures. Seems there isn't in the way I need it, right ? All pictures are saved and manipulated in PhotoShop as gif's.

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    As my site contains lots of pictures (that's what artists do), I just wanted to see if there is a big difference, so to improve the quality of the pictures. Seems there isn't in the way I need it, right ? All pictures are saved and manipulated in PhotoShop as gif's.
    Yes, this is a bad idea due to GIF's limitation to 256 colours. The standard procedure here is to save in a high-quality, lossless format (TARGA has been historically used for this, but PNG is just as suitable). Use this for manipulation, then save as a JPEG for distribution, since you want the filesize as small as possible. Make sure to only save it as a JPEG once; this will minimise the degradation caused. If you modify it, modify the original image then save a new JPEG from that.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •