all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: "Nicolas Léveillé" <nicolas@uucidl.com>
Cc: 17519@debbugs.gnu.org
Subject: bug#17519: [PATCH] take into account QuantumScale when reading imagemagick images
Date: Mon, 19 May 2014 13:04:12 -0700	[thread overview]
Message-ID: <537A63BC.5090408@cs.ucla.edu> (raw)
In-Reply-To: <C6926551-6A17-42FF-8A41-D365BFAF7CB8@uucidl.com>

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

Thanks for reporting this. Does the attached simpler patch fix the 
problem for you?  Dividing by QuantumRange instead of multiplying by 
QuantumScale avoids potential double-rounding problems in future 
versions of ImageMagick.

[-- Attachment #2: imagemagick.patch --]
[-- Type: text/x-patch, Size: 919 bytes --]

=== modified file 'src/image.c'
--- src/image.c	2014-05-04 18:51:32 +0000
+++ src/image.c	2014-05-19 19:47:21 +0000
@@ -8388,6 +8388,7 @@
 #endif /* HAVE_MAGICKEXPORTIMAGEPIXELS */
     {
       size_t image_height;
+      double color_scale = 65535.0 / QuantumRange;
 
       /* Try to create a x pixmap to hold the imagemagick pixmap.  */
       if (!image_create_x_image_and_pixmap (f, img, width, height, 0,
@@ -8428,9 +8429,9 @@
               PixelGetMagickColor (pixels[x], &pixel);
               XPutPixel (ximg, x, y,
                          lookup_rgb_color (f,
-                                           pixel.red,
-                                           pixel.green,
-                                           pixel.blue));
+					   color_scale * pixel.red,
+					   color_scale * pixel.green,
+					   color_scale * pixel.blue));
             }
         }
       DestroyPixelIterator (iterator);


  reply	other threads:[~2014-05-19 20:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-17 13:25 bug#17519: [PATCH] take into account QuantumScale when reading imagemagick images Nicolas Léveillé
2014-05-19 20:04 ` Paul Eggert [this message]
2014-05-20  7:37   ` Nicolas Léveillé
2014-05-20  8:07     ` Paul Eggert
2014-05-21 19:31   ` Nicolas Léveillé
2014-05-21 19:54     ` Paul Eggert

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

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

  git send-email \
    --in-reply-to=537A63BC.5090408@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=17519@debbugs.gnu.org \
    --cc=nicolas@uucidl.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.