unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David.Kastrup@t-online.de (David Kastrup)
Cc: emacs-devel@gnu.org
Subject: Re: PNG pictures have gamma correction twice applied
Date: 05 Dec 2002 18:31:00 +0100	[thread overview]
Message-ID: <x57keoe5kb.fsf@lola.goethe.zz> (raw)
In-Reply-To: E18JxcX-0007Vm-00@fencepost.gnu.org

[-- Attachment #1: Type: text/plain, Size: 496 bytes --]

Richard Stallman <rms@gnu.org> writes:

> We don't want to change the PNG library.  We want to use it
> unmodified.  Can you find a solution to this one problem
> that invoves changing Emacs and not the PNG library?

I have verified that the following patch will stop the double gamma
correction particular to PNG images.  I _strongly_ stress that this
is _not_ the proper way to fix Emacs' lack of proper color handling
here and elsewhere.

For that reason, I will not apply this patch myself.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Don't tell PNG library about gamma which we do ourselves --]
[-- Type: text/x-patch, Size: 1526 bytes --]

*** xfns.c.~1.565.~	2002-11-14 17:21:29.000000000 +0100
--- xfns.c	2002-12-05 17:35:07.000000000 +0100
***************
*** 9004,9010 ****
    screen_gamma = (f->gamma ? 1 / f->gamma / 0.45455 : 2.2);
  
    /* Tell the PNG lib to handle gamma correction for us.  */
! 
  #if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED)
    if (png_get_sRGB (png_ptr, info_ptr, &intent))
      /* The libpng documentation says this is right in this case.  */
--- 9004,9010 ----
    screen_gamma = (f->gamma ? 1 / f->gamma / 0.45455 : 2.2);
  
    /* Tell the PNG lib to handle gamma correction for us.  */
! #if 0
  #if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED)
    if (png_get_sRGB (png_ptr, info_ptr, &intent))
      /* The libpng documentation says this is right in this case.  */
***************
*** 9017,9023 ****
    else
      /* Use the standard default for the image gamma.  */
      png_set_gamma (png_ptr, screen_gamma, 0.45455);
! 
    /* Handle alpha channel by combining the image with a background
       color.  Do this only if a real alpha channel is supplied.  For
       simple transparency, we prefer a clipping mask.  */
--- 9017,9023 ----
    else
      /* Use the standard default for the image gamma.  */
      png_set_gamma (png_ptr, screen_gamma, 0.45455);
! #endif
    /* Handle alpha channel by combining the image with a background
       color.  Do this only if a real alpha channel is supplied.  For
       simple transparency, we prefer a clipping mask.  */

[-- Attachment #3: Type: text/plain, Size: 52 bytes --]



-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

  parent reply	other threads:[~2002-12-05 17:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200211061556.gA6FuCU6005082@localhost.localdomain>
2002-11-07 15:08 ` PNG pictures have gamma correction twice applied Richard Stallman
2002-11-09 22:40   ` David Kastrup
2002-11-11 10:20     ` Richard Stallman
2002-11-30 13:36       ` David Kastrup
2002-12-03 14:59         ` Richard Stallman
2002-12-03 15:21           ` David Kastrup
2002-12-05 15:08             ` Richard Stallman
2002-12-05 15:34               ` David Kastrup
2002-12-05 17:31               ` David Kastrup [this message]
2002-12-06 15:52                 ` Richard Stallman
2002-12-06 16:01                   ` David Kastrup
2002-11-11 16:58     ` Stefan Monnier
2002-11-11 17:30       ` David Kastrup
2002-11-11 17:43         ` Stefan Monnier
2002-11-18 11:31           ` David Kastrup

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=x57keoe5kb.fsf@lola.goethe.zz \
    --to=david.kastrup@t-online.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).