Export behaviour for fully transparent backgrounds

2000-04-10 Thread Kevin Turner

Goal: Make an image with a transparent background for your web-page,
clip-art, etc.
Issue: PNG file size is bloated by losslessly saving "invisible" data.

. Acquire image,
. Select the backdrop, leaving the subject of the picture untouched,
. ensure the drawable has an Alpha channel,
. Erase or Clear the selection,
. save as PNG.

Thing is, gimp does erase/clear by setting the alpha component to fully
transparent, but doesn't touch the other channels.  So you can load up
that image again, move the alpha channel back to opaque, and the
background you erased comes back in full detail.

This isn't a bug, as png is a lossless format, but saving all that
detail which you intended to discard is a feature that does increase
your file size.  Solution?  Perhaps just a footnote in the manual and
the help page for the PNG save-filter.  Or maybe semi-lossy filter to
optionally run upon export, which replaces the data in these invisible
pixels with more compressible stuff.  The "GIMP That's Smarter Than You
Are" (sponsored by the Corporation for Using Technology to Further Human
Inferiority Complexes) could detect this fairly trivially, and ask if
you really meant to be saving that stuff.  The semi-lossy filter could
be as simple as this mathmap[1] filter:

if alpha(origVal(xy)) == 0 then rgba:[0,0,0,0] else origVal(xy) end

although it's imaginable that some color which matched the non-invisible
parts of the image would be more compressible than 0,0,0.  A more
complex "lossy filter" would require intimate knowledge of the export
format, and (now I'm starting to stray into the jpeg thread) could do
things like the "jpeg-blur" mentioned recently.

I do like the neatness of the idea of being able to select which parts
of the image may have their quality sacfiriced to achieve better
compression, while the subject of the image retains most of its quality,
but I feel like that problem might get rather tricky and the returns in
practice may be fairly small...

[1] MathMap plug-in: http://www.complang.tuwien.ac.at/~schani/mathmap/
A plug-in which lets you rapidly make a variety of filters.
Good fun and useful in developing your own filters and effects.

-- 
Kevin Turner [EMAIL PROTECTED] | OpenPGP encryption welcome here



Re: Export behaviour for fully transparent backgrounds

2000-04-10 Thread Nick Lamb

On Tue, Apr 11, 2000 at 02:58:38AM +0200, Sven Neumann wrote:
 Hi,
 
 On Mon, Apr 10, 2000 at 05:20:03PM -0700, Kevin Turner wrote:
  Goal: Make an image with a transparent background for your web-page,
  clip-art, etc.
  Issue: PNG file size is bloated by losslessly saving "invisible" data.
 
 IMHO, this should be handled completely inside the PNG plug-in. 

Why?

Nick.