From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: Re: PNG image files with alpha channel Date: Fri, 09 May 2008 00:39:27 +0900 Message-ID: <87tzh8yfdc.fsf@catnip.gol.com> References: <87ve1pdnjq.fsf@stupidchicken.com> <4822EC6F.6000703@gnu.org> <87zlr0yh2y.fsf@catnip.gol.com> <482319D6.1020308@gnu.org> Reply-To: Miles Bader NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1210261203 32004 80.91.229.12 (8 May 2008 15:40:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 May 2008 15:40:03 +0000 (UTC) Cc: Chong Yidong , emacs-devel@gnu.org To: Jason Rumney Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 08 17:40:38 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Ju8EU-0003UE-CF for ged-emacs-devel@m.gmane.org; Thu, 08 May 2008 17:40:34 +0200 Original-Received: from localhost ([127.0.0.1]:52689 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ju8Dm-0000Jm-7E for ged-emacs-devel@m.gmane.org; Thu, 08 May 2008 11:39:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ju8Dh-0000JM-Ed for emacs-devel@gnu.org; Thu, 08 May 2008 11:39:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ju8Df-0000Iq-E7 for emacs-devel@gnu.org; Thu, 08 May 2008 11:39:44 -0400 Original-Received: from [199.232.76.173] (port=45588 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ju8Df-0000Ig-An for emacs-devel@gnu.org; Thu, 08 May 2008 11:39:43 -0400 Original-Received: from smtp11.dentaku.gol.com ([203.216.5.73]:47463) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ju8DV-0005dG-9y; Thu, 08 May 2008 11:39:33 -0400 Original-Received: from 203-216-99-062.dsl.gol.ne.jp ([203.216.99.62] helo=catnip.gol.com) by smtp11.dentaku.gol.com with esmtpa (Dentaku) id 1Ju8DT-0003xz-3F; Fri, 09 May 2008 00:39:31 +0900 Original-Received: by catnip.gol.com (Postfix, from userid 1000) id B4D232F4D; Fri, 9 May 2008 00:39:27 +0900 (JST) System-Type: i686-pc-linux-gnu In-Reply-To: <482319D6.1020308@gnu.org> (Jason Rumney's message of "Thu, 08 May 2008 16:18:46 +0100") Original-Lines: 41 X-Virus-Scanned: ClamAV GOL (outbound) X-Abuse-Complaints: abuse@gol.com X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:96792 Archived-At: Jason Rumney writes: >> png_set_IHDR (libpng_struct, libpng_info, width, height, >> 8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, >> PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); >> png_set_gAMA (libpng_struct, libpng_info, gamma_correction); > > Is there any program that can dump a PNG header in some readable format, > so we can compare yours with the image that Gimp saves? > > Or maybe someone needs to step through the PNG display code in Emacs, > and see where it (or libpng) makes the wrong decision. Actually I realized that while my software wrote the original image, those "*-256.png", etc, images are decimated versions that I created using imagemagick, with "convert -resize ...". Upon looking closer, I see on very odd attribute: while the original image I wrote was RGBA, 8-bits per channel, the decimated versions written by imagemagick are RGBA, 16-bits per channel... The Emacs PNG-reading code asks libpng to convert 16-bit-per-channel images to 8-bits per channel, but as such images are fairly rare, it may be that libpng doesn't do it correctly. If I open the original RGBA 8-bits per channel image with Emacs, indeed, it handles the alpha-channel correctly. I did step through the code, BTW, and as far as I can tell, Emacs is doing the correct things. So the problem may in fact be something with the libpng 16-to-8-bit conversion code... [I have no idea why imagemagick creates 16-bit-per-channel output images from 8-bit-per-channel input images; offhand it seems like a bad idea as 16-bit support is probably less widespread...] -Miles -- Idiot, n. A member of a large and powerful tribe whose influence in human affairs has always been dominant and controlling.