
{"id":4112,"date":"2010-12-14T20:19:11","date_gmt":"2010-12-14T14:49:11","guid":{"rendered":"http:\/\/www.froisa.com\/?p=4112"},"modified":"2010-12-14T20:19:11","modified_gmt":"2010-12-14T14:49:11","slug":"desaturate-base-on-luminosity","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2010\/12\/14\/desaturate-base-on-luminosity\/","title":{"rendered":"gimp + desaturate based on luminosity"},"content":{"rendered":"<pre>\n\/* GIMP - The GNU Image Manipulation Program\n * Copyright (C) 1995 Spencer Kimball and Peter Mattis\n *\n * This program is free software; you can redistribute it and\/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n *\/\n<\/pre>\n<pre>\nstatic void\ndesaturate_region_luminosity (PixelRegion    *srcPR,\n                              PixelRegion    *destPR,\n                              const gboolean  has_alpha)\n{\n  const guchar *src  = srcPR-&gt;data;\n  guchar       *dest = destPR-&gt;data;\n  gint          h    = srcPR-&gt;h;\n\n  while (h--)\n    {\n      const guchar *s = src;\n      guchar       *d = dest;\n      gint          j;\n\n      for (j = 0; j w; j++)\n        {\n          gint luminosity = GIMP_RGB_LUMINANCE (s[RED_PIX],\n                                                s[GREEN_PIX],\n                                                s[BLUE_PIX]) + 0.5;\n\n          d[RED_PIX]   = luminosity;\n          d[GREEN_PIX] = luminosity;\n          d[BLUE_PIX]  = luminosity;\n\n          if (has_alpha)\n            d[ALPHA_PIX] = s[ALPHA_PIX];\n\n          d += destPR-&gt;bytes;\n          s += srcPR-&gt;bytes;\n        }\n\n      src += srcPR-&gt;rowstride;\n      dest += destPR-&gt;rowstride;\n    }\n}\n\n<\/pre>\n<p><a href=\"http:\/\/www.jeffgraphics.in\/2010\/12\/14\/204\/\">http:\/\/www.jeffgraphics.in\/2010\/12\/14\/204\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/* GIMP &#8211; The GNU Image Manipulation Program * Copyright (C) 1995 Spencer Kimball and Peter Mattis * * This program is free software; you can redistribute it and\/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2010\/12\/14\/desaturate-base-on-luminosity\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;gimp + desaturate based on luminosity&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/4112"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=4112"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/4112\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=4112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=4112"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=4112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}