Fun Stuff > MAKE

Compressing PNGs

(1/2) > >>

Neskah:
After reading the advice tips around qc I changed a few of my images files to PNG. The difference is amazing. The image is infinately cleaner, clearer and just pretty.

the issue has arisen however, that PNG are much larger file sizes then jpgs. much much much larger.

I don't want to give up my PNGs, i've grown found of the quality, but is there a way i can compress the files on my website? QC doesn't eat my bandwidth when i visit, i don't want my site to be one that does.


Any advice?

Sideways:
Use PKZIP.

PNG uses the Deflate compression method, used in the popular pkzip file archiving utility. Deflate is an improved version of the Lempel-Ziv compression algorithm [LZ77]. It works similarly to the LZW algorithm, and looks for repeated horizontal patterns along each scan line. To further enhance compression, PNG prefilters the image data using predictor functions before it's compressed. PNG uses four predictor functions, two of which address vertical patterns.

So PNG behaves like GIF in that it compresses horizontal patterns, but PNG's filters also find vertical patterns, resulting in additional compression.

decklin:
Erm, how does pkzip help? you can't compress something that's already compressed.

To optimize PNG's compression as much as humanly (or... computerly, i guess) possible, use pngcrush.

If you are talking about photographic images, however, PNG is *always* going to be larger. PNG is a lossless compression algorithm and JPEG is a lossy one.

Valrus:
Yeah, PNG is better for images with big homogeneous blocks like those in, say, Penny Arcade comic strips or decklin's current avatar. Pictures with more subtle gradations or lots of color changes like, as decklin said, most photographs, will be much better served by JPG.

decklin:
PNG also has an alpha channel, which is how I have my avatar blend into the background of the page. :)

I only use a 1-bit alpha (transparent or opaque), but PNG offers the possibility of a full 8-bit alpha channel for varying levels of translucency. Not all web browsers support such PNGs though.

Navigation

[0] Message Index

[#] Next page

Go to full version