GIF or JPG?

Discussion in 'HTML' started by L.Jones, Jul 24, 2004.

  1. L.Jones

    L.Jones Guest

    Why do some people use GIF image files over JPG , even when the image is a
    still one and not animation?

    Also, the psuedo element <img src="../../*.jpg"> loads current IE and NN
    browsers with my images, but not OPERA. Instead, it shows the word 'IMAGE',
    as if I have the pathname wrong. But it's right. What gives?

    L.
    L.Jones, Jul 24, 2004
    #1
    1. Advertising

  2. L.Jones

    Kurt Weber Guest

    "L.Jones" <> wrote in message
    news:%UjMc.1285$...
    > Why do some people use GIF image files over JPG , even when the image is a
    > still one and not animation?
    >
    > Also, the psuedo element <img src="../../*.jpg"> loads current IE and NN
    > browsers with my images, but not OPERA. Instead, it shows the word

    'IMAGE',
    > as if I have the pathname wrong. But it's right. What gives?


    It has to do with the compression algorithms.

    GIF uses a lossless algorithm, so it is useful for simple line art and other
    images that don't involve a significant degree of color variation.

    JPEG, on the other hand, uses a lossy algorithm that, in effect, blends
    several adjacent pixels into one, making it more useful for photographs,
    complex 3-D images, etc. that have significant color variation and fine
    detail that is not likely to be noticed when "smoothed over", so to speak.

    --
    Kurt Weber
    Kurt Weber, Jul 24, 2004
    #2
    1. Advertising

  3. L.Jones

    Kurt Weber Guest

    Let me be a bit more detailed.

    GIF uses the LZW compression algorithm, an algorithm which enables one to
    produce a complete replica of the original data. To do this, the software
    finds certain recurring bit patterns in the original data. For each pattern
    it finds, it assigns it an identifier that is shorter than the data it
    represents. Then, every time that particular pattern appears in the data,
    it is replaced with that identifier. In the GIF file is a table listing the
    identifiers and the patterns they replace so the reader can reconstruct the
    original example.

    As a somewhat contrived example, imagine that you are writing a paper on,
    say, the Spanish Inquisition. You have a computer on which you can do all
    the edits and revisions, but you don't have access to a printer or removable
    storage, so you are forced to submit a handwritten copy. Since writing
    things out by hand takes time, you decide to assign certain codes to certain
    words that appear quite often in the text. For example, every instance of
    "Torquemada" is assigned "A1", every instance of "ideology" is assigned
    "A2", every instance of "the" is assigned A3, and so on. So the paper you
    give to your professor is a sequence of codes that required much less
    writing than writing out the entire thing would have been, and attached is a
    table correlating each code to the word it represents. All your professor
    has to do, then, is go through this table and replace each code with its
    associated word, after which he is free to corner the market on red ink.

    LZW (which GIF uses) is ideal, then, for simple line-art pictures because
    such images are likely to contain several repeating patterns of data--for
    example, a large plain white background with a regular area of green or
    purple inside, perhaps with a sequence of red-purple-orange-blue-red
    occurring several times as well. This doesn't work so well with photographs
    which, by their very nature, generally do not have many repeating patterns
    within. As a result, GIF would almost certainly not produce any significant
    improvement in file size on a photograph (and in fact would probably be
    larger than the original data because of the metadata overhead). Instead,
    photographs are generally distributed in the JPEG format, which essentially
    "smears" similar pixels in an area together to reduce the amount of data
    necessary. While this would probably not have an adverse affect on the
    types of images for which GIF is typically used, GIF generally produces
    better compression ratios on simple images than JPEG does.

    --
    Kurt Weber
    Kurt Weber, Jul 24, 2004
    #3
  4. L.Jones

    Webcastmaker Guest

    In article <%UjMc.1285$>,
    says...
    > Why do some people use GIF image files over JPG , even when the image is a
    > still one and not animation?


    Because different images are better displayed in one or the other.

    --
    WebcastMaker
    The easiest and most affordable way to create
    Web casts, or put presentations on the Web.
    www.webentations.com
    Webcastmaker, Jul 24, 2004
    #4
  5. L.Jones

    Webcastmaker Guest

    In article <>,
    says...
    > Let me be a bit more detailed...

    <snip/>

    Man, are you on meth?

    --
    WebcastMaker
    The easiest and most affordable way to create
    Web casts, or put presentations on the Web.
    www.webentations.com
    Webcastmaker, Jul 24, 2004
    #5
  6. L.Jones

    Spartanicus Guest

    "L.Jones" <> wrote:

    >Also, the psuedo element <img src="../../*.jpg"> loads current IE and NN
    >browsers with my images, but not OPERA. Instead, it shows the word 'IMAGE',
    >as if I have the pathname wrong. But it's right.


    No it's not, upload it and provide the url.

    And img is not a "pseudo" element.

    --
    Spartanicus
    Spartanicus, Jul 24, 2004
    #6
  7. L.Jones

    Toby Inkster Guest

    Kurt Weber wrote:

    > As a somewhat contrived example, imagine that you are writing a paper on,
    > say, the Spanish Inquisition. [...] For example, every instance of
    > "Torquemada" is assigned "A1", every instance of "ideology" is assigned
    > "A2", every instance of "the" is assigned A3, and so on.


    Actually, the concept you've just described is a substitutional compressor.
    LZW is an algortithm for choosing the best words to include in the
    dictionary when using such a compression method. To continue your analogy
    LZW will tell you whether it's better to substitute A1 with "Torquemada"
    or with "Madrid" (perhaps because "Torquemada" is longer, but "Madrid"
    occurs more often in the text?)

    There is a nice write up and example here:
    http://computer.howstuffworks.com/file-compression.htm/printable

    To further your analogy, JPEG compression is just like writing a 3-line
    summary of the original paper on the Spanish Inquisition.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Now Playing ~ ./aerosmith/aerosmith_-_i_dont_want_to_miss_a_thing.ogg
    Toby Inkster, Jul 24, 2004
    #7
  8. L.Jones

    Frogleg Guest

    On Fri, 23 Jul 2004 23:32:17 -0400, Webcastmaker
    <> wrote:

    >In article <>,
    >says...
    >> Let me be a bit more detailed...

    ><snip/>
    >
    >Man, are you on meth?


    Actually, the first paragraph was a very neat explanation. I tried to
    understand LZW for years, and could certainly have used this
    clarification. Just stop reading after para #1. :)
    Frogleg, Jul 24, 2004
    #8
  9. L.Jones

    Kurt Weber Guest

    "Toby Inkster" <> wrote in message
    news:p...
    > Kurt Weber wrote:
    >
    > > As a somewhat contrived example, imagine that you are writing a paper

    on,
    > > say, the Spanish Inquisition. [...] For example, every instance of
    > > "Torquemada" is assigned "A1", every instance of "ideology" is assigned
    > > "A2", every instance of "the" is assigned A3, and so on.

    >
    > Actually, the concept you've just described is a substitutional

    compressor.
    > LZW is an algortithm for choosing the best words to include in the
    > dictionary when using such a compression method. To continue your analogy
    > LZW will tell you whether it's better to substitute A1 with "Torquemada"
    > or with "Madrid" (perhaps because "Torquemada" is longer, but "Madrid"
    > occurs more often in the text?)


    Yeah, I realized afterwards that LZW was simply a particular ALGORITHM for
    using the concept, but by then my fingers were tired and I figured he'd get
    the idea regardless :)

    --
    Kurt Weber
    Kurt Weber, Jul 24, 2004
    #9
  10. patching the url from the uploaded jpg file into Opera,.then patching it
    into a <img src="..."> element still does not allow Opera to open my jpg
    files from my HTML (and CSS) code. Again, IE and NN both work. Same code.
    Same pathname.

    I re-installed Opera. No luck.

    Does anyone else have this problem with Opera?
    confused replies, Jul 25, 2004
    #10
  11. L.Jones

    rf Guest

    confused replies wrote

    > patching the url from the uploaded jpg file into Opera,.then patching it
    > into a <img src="..."> element still does not allow Opera to open my jpg
    > files from my HTML (and CSS) code. Again, IE and NN both work. Same

    code.
    > Same pathname.
    >
    > I re-installed Opera. No luck.
    >
    > Does anyone else have this problem with Opera?


    Without a URL I can't even *see* the problem.

    --
    Cheers
    Richard.
    rf, Jul 25, 2004
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roland
    Replies:
    0
    Views:
    1,053
    Roland
    May 12, 2004
  2. Matthias
    Replies:
    5
    Views:
    423
    Whitecrest
    Jun 1, 2004
  3. Beauregard T. Shagnasty

    Re: filename.gif or filename.gif.jpg?

    Beauregard T. Shagnasty, May 30, 2008, in forum: HTML
    Replies:
    1
    Views:
    745
    Jonathan N. Little
    May 30, 2008
  4. Bergamot
    Replies:
    0
    Views:
    450
    Bergamot
    May 30, 2008
  5. Yannick

    ASP changes Big JPG -> Small JPG

    Yannick, Feb 2, 2004, in forum: ASP General
    Replies:
    6
    Views:
    150
    Tim Williams
    Feb 3, 2004
Loading...

Share This Page