Re: Graphic Images


Subject: Re: Graphic Images
From: Dom Lachowicz (cinamod@hotmail.com)
Date: Fri Apr 20 2001 - 03:39:52 CDT


> > - which bloats our binary the least?
>
>libjpeg and libpng. Making them static or dynamic will depend on the
>platform.
>Most Linux distro and *BSD have them as packages. GNOME build require them.
>For MacOS X, I'll put them as a shared library inside the bundle (to save
>memory),
>and BeOS provide them too.

libjpeg and libpng add more total function calls and loc than a GdkPixbuf or
IM solution (besides which, you're getting more bang for your buck), so
they'd actually bloat the binary more. As for total memory usage, IM/GDK is
probably higher though, but not necessarily (GdkPixbuf, etc. might already
be already in shared memory).

> > - which is most efficient at run-time? (both speed and memory)
>
>The less layer we have, the best efficient it is. libpng and libjpeg are
>low level
>and easy to use. So I think we should use them directly.

I haven't seen the JPEG code yet so I'm not quite sure what you're doing to
get a JPEG onto the screen (much less to a unix PS printer) but I have a
feeling that you're doing:

JPEG->RGBA->PNG->RGBA->SCREEN (much like the BPM loader code) which
certainly wouldn't be faster or easier on memory than JPEG->RGBA->SCREEN
that IM or GdkPixbuf would allow for. I also don't see the need for learning
many low-level APIs instead of 1 or two high-level ones.

Let me be the devil's advocate here for a second. (ignoring patent/other
issues) We want to load a GIF. Ok, so we want to turn a GIF into a PNG. So
what can we do? Well, we have libungif to disassemble the GIF, so we have to
learn that (or gif2png... quite a bit of code itself). Or maybe we don't
want libungif. So we go and write our own. Now we put the RGBA back together
into a PNG, meaning that we now have libungif linked to our binary as well
as libjpeg and libpng.

Now I want to do TIFF. Then XPM. Then XBM. Then &c... So for every useful
image format that we want to support, we end up adding 1 library on top of
those we already ship + a new low-level API that someone must now learn and
use and maintain code for. <sarcasm>Sounds pleasant</sarcasm>

Now, I ask, how is this better than IM or some other similar solution? If
for some reason we do want to support libjpeg, libungif, etc.. why don't we
use libungif to just extract RGBA data from the image and render that to
screen instead of all this middleware conversion stuff?

Confused,
Dom

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com



This archive was generated by hypermail 2b25 : Fri Apr 20 2001 - 03:40:13 CDT