emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PNG pictures have gamma correction twice applied


From: David Kastrup
Subject: Re: PNG pictures have gamma correction twice applied
Date: Tue, 3 Dec 2002 16:21:04 +0100

Richard Stallman <address@hidden> writes:

>     > Would you like to rewrite the png code thoroughly?
> 
>     Unfortunately, it is not just the PNG code, it is the entire
>     color/image management that is involved here.
> 
> That is rather vague--could you be more concrete?  Are you saying that
> Emacs does a spurious extra gamma correction for some of the other
> image formats also?  If that is not what you mean then I have no idea
> what the intended meaning is.

It would appear that you have lost track of the discussion a bit.  The
double gamma correction was just one of the problems with the current
code base.

Further problems included that the current code base became incredibly
inefficient where images got involved, because it used the code
intended for text pixel-by-pixel.  On direct color displays, the
involved hash stuff is completely unnecessary, and on paletted
displays, showing colored images results in self-defeating
color-hogging from Emacs (which would use up the palette on the first
part of an image, not having suitable colors left afterwards).  Since
those colors are only allocated, but never deallocated, this
color-hogging is completely irreversible within one Emacs session.

Emacs color-handling is broken as it is.  The discussion has moved on
to what one might do about this.  The double gamma correction issue
is only a side aspect, "fixed" easily enough.

>                             or we will not be able to have images blend
>     seamlessly into the background of the buffer, the images being
>     rendered to a different palette part than the "exact match" colors.
> 
> I cannot follow the logic of the argument you are trying to make.  As
> far as I can see, eliminating the spurious extra gamma correction
> will make text and images MORE compatible, not less so.

Of course.  The current behavior is appallingly wrong.  I was
discussing with what should replace it.  What was suggested that for
paletted displays, a fixed palette for images could be allocated, but
the current behavior retained for texts.  I pointed out that this
would mean that images could not be created in order to exactly match
colors from the text display, such as the frame background.

>     Anyhow, the way I see it there is not much sense in reinventing
>     the wheel.  This sort of color management is rather tedious to
>     do in X11, and the work has been done already.  For example, the
>     Gdk library deals with all sorts of different color models, and
>     there is even a Windows port (avaunt!) available if I am not
>     mistaken.
> 
> I doubt it would work to make Emacs use GDK all the time, but if you
> can adapt the color management code from GDK, maybe we could make
> Emacs call a stripped-down version of it.

Yes, that was about the idea.

> But I think this is all irrelevant.  We are talking about
> eliminating a duplicate gamma correction step.  That is a very
> simple issue to think about.  Bringing in lots of other things makes
> a simple issue complex, and that is an impediment to solving it.
> 
> Would you like to get rid of the extra gamma correction?

That would be trivially solved by ripping out the gamma correction
the PNG library does.  Then PNG would "just" behave like the other
image formats and the text.

I am just saying that this is not going to make Emacs color/image
handling near to sane.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

[Prev in Thread] Current Thread [Next in Thread]