Currently, gif files compress images by showing how long a row of pixles of the same color goes horizontally. However, this creates problems for an image that is vertical stripes of color. Because the a new color has to be defined every few pixels, the file size is much higher. There should be some sort of file type that was a vertical GIF, so to speak.
Ok. I had absolutely no idea what I was talking about. Excuse my existence.-- dontthink, May 18 2000 PNG -- designed to replace GIF http://www.libpng.org/pub/png/includes better compression, and is copyright free [johan, May 18 2000, last modified Oct 04 2004] Burn All Gifs http://burnallgifs.org/Why you don't want to be using GIFs, anyway. [johan, May 18 2000, last modified Oct 04 2004] (?) Introduction to Image Compression http://www.image.ci...n/thesis/node9.htmlDescription of some well-known image compression algorithms, including Lempel-Ziv. [jutta, May 18 2000] comp.compression FAQ part 1 http://www.faqs.org...pression-faq/part1/References for various image compression methods. [jutta, May 18 2000] Content negotiation example... http://ofb.net/logoShould return PNG for browsers that support it, GIF otherwise. [egnor, May 18 2000, last modified Oct 04 2004] Or better, something that figures out whether it should be a -- or a | gif...and doesn't break every single sort of picture viewer existing in the process...-- StarChaser, May 20 2000 PNG being what I was referring to by 'break every single sort of picture viewer'...It works, but I'd have to replace my small and quick viewer with something huge and clunky. I may end up doing that, but I don't want to if I can help it. I like having the picture appear when I click on the icon, and not having to wait five minutes for splash screens and 'loading'.-- StarChaser, May 21 2000 GIF doesn't do run-length encoding, it does Lempel-Ziv & Welch, which is a lot more interesting.-- jutta, May 21 2000 You may have a big and clunky PNG viewer, but there are certainly small and light ones. Most major browsers support PNG these days, and you're probably running a browser anyway, aren't you?-- egnor, May 21 2000 Yeah, but 'browser' != 'viewer'. The browser is a big and clunky thing itself. I've got an old version of Lview <because the new one is big and clunky> that opens a picture in less than a second, where Photoshop or either browser spends a long time setting things up and loading crap and showing splash screens and...-- StarChaser, May 21 2000 Mmmm, Lview. Yeah, that version from 1994 is the best, except for the way it doesn't understand progressive JPEGs or interlaced GIFs.-- Eeyore, May 23 2000 Yeah, that's the one real complaint I have with it, but then I open them in Photoshop, convert them once, and never have a problem again...-- StarChaser, May 24 2000 I would like to add a "PNG" attribute to the IMG tag so that PNG-aware browsers would fetch the image file from the PNG= location while GIF-only browsers would use the SRC= location.
On a related note, a utility to lossy-convert images to PNG would be nice; while it's good that PNG is lossless, when small size is more important than quality it would be nice to take a one-time "hit" and have the compression utility adjust pixels so as to compress better.-- supercat, Jun 27 2000 There's no need for a gross, special-purpose "PNG=" attribute. Content autonegotiation is a general-purpose standard which already fits the need and works in most browsers! You use the usual <IMG SRC="foo"> tag, and instruct the Web server to return either of "foo.gif" or "foo.jpg" depending on what the browser claims to be able to support.
Apache can do this out of the box, for example (just turn on the "MultiViews" option).
If you want lossy conversion, why not just use JPEG? (Alternatively, I find that reducing an image's palette will often improve PNG compression. Most image manipulation tools have a "posterize" command to do this. I use "pnmquant".)-- egnor, Oct 22 2000 'Most' browsers. Doesn't work in IE. Someone kept putting up auctions in Ebay linking to pictures from their webpage on Geocities using the correct format except for leaving the file type off, and they showed as broken pictures. I could get the picture by going to the address with the correct format.-- StarChaser, Oct 22 2000 That's a problem with the server, not the browser. Done properly, content autonegotiation is totally transparent, and if the browser doesn't support it, the server will return the "lowest common denominator" (GIF in this case).
I've added an example (see link).-- egnor, Oct 22 2000 //If you want lossy conversion, why not just use JPEG?//
The problem with something like JPEG is that except at high-quality settings it tends to "munge" things like superimposed text. If I take a .JPG, add some text, and re-save as .JPG, the text will usually end up with wierd fringies around it. If I instead were to 'save lossily' to .PNG, load that file, add the text, and resave as .PNG, then things would end up much nicer.
On a related note: from what I understand a .JPG file is made up of independent 8x8-pixel blocks. Would it be possible to design an editor which, when saving a .JPG file after after loading an editing it, would leave precisely untouched those 8x8 blocks which had not been edited? As it is I find it very hard to edit a .JPG and resave it without either having the file-size grow (if I use too high a quality setting) or the quality get degraded (if I don't).-- supercat, Dec 20 2000 For sideways-compressing GIFs (or PNGs), why not just rotate your image 90 degrees before compressing and tell viewers to tilt their heads to one side? Or you might be able to use CSS2 to tell the browser to render the image rotated.
Also, I don't think anyone has pointed out that GIF is not run-length encoding, it is LZW and that won't do too badly for vertically striped images, since successive horizontal lines of the image will have similar sequences of pixels. Perhaps GIF does have a preliminary RLE stage, in which case a 'vertical' version would give some improvement - but it's not all or nothing. And, of course, you should be using PNG anyway.
About the lossy compression with PNG which supercat asked about: have a look at <http://membled.com/work/apps/lossy_png/> which is just that - although in a very unfinished state. The current version doesn't do as well as JPEG on most photos, but it does have the 'one-time hit' property: you can compress an image lossily, edit it a bit and then recompress with ordinary lossless compression, keeping most of the space savings from the original compression but not losing any more detail.-- Ed Avis, Oct 11 2002 PNG beats GIF easily, all possible colours, not just 256 (gif photos are awful) and PNGs keep the transparency too!-- Herbicide, Apr 14 2004 random, halfbakery