After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 558454 - Plugin Map Color Range disappears from GIMP
Plugin Map Color Range disappears from GIMP
Status: VERIFIED FIXED
Product: GIMP
Classification: Other
Component: Plugins
2.6.1
Other All
: Normal minor
: 2.6
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2008-10-29 21:22 UTC by Eric Lamarque
Modified: 2008-11-30 14:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
mapcolor plug-in implemented through gimp-levels (15.21 KB, text/plain)
2008-11-02 21:34 UTC, Eric Lamarque
  Details
patch adding a compat function to script-fu (4.10 KB, patch)
2008-11-18 23:12 UTC, Sven Neumann
committed Details | Review

Description Eric Lamarque 2008-10-29 21:22:31 UTC
Please describe the problem:
Since Gimp 2.5.0, Map color range was removed from the standard plugin distribution. See bug #436145.
Anyway, I feel that color-map was victim of the second procedure entry in mapcolor plugin : adjust-fgbg.

Steps to reproduce:
1. Launch Aurora Logo script at http://registry.gimp.org/node/10890



Actual results:
plug-in-color-map : undefined symbol


Expected results:
An aurora logo

Does this happen every time?
yes

Other information:
It seems to be an API breakage. Could the plugin mapcolor be reincluded, only removing the problematic adjust-fgbg?
Comment 1 Sven Neumann 2008-10-29 22:15:51 UTC
We could add it back w/o registering a menu entry.
Comment 2 Sven Neumann 2008-10-29 22:57:39 UTC
Looking at it again, the plug-in really was so badly broken, I would prefer if we would not have to add it back. Can a similar functionality perhaps be achieved by other means?
Comment 3 Eric Lamarque 2008-10-30 21:36:42 UTC
It could be achieve by other means. Map color range provide a linear variation from source color to destination color. The linear could be mapped to levels.

Playing with the idea, I was able to build a new mapcolor plugin using gimp-level. The problem is that I don't know how to display preview for gimp-levels?

Anyway, here is a sample script that seems to realize the Color Range Mapping. I say 'seem' as I only use it on examples I know, such as aurora logo script, and changing existing gradient to another one.

(define (change-color-map img layer srcCol1 srcCol2 dstCol1 dstCol2)
    (let* ()
      (gimp-levels layer HISTOGRAM-RED (car srcCol1) (car srcCol2) 1.0
                   (- 255 (car dstCol1)) (- 255 (car dstCol2)))
      (gimp-levels layer HISTOGRAM-GREEN (cadr srcCol1) (cadr srcCol2) 1.0
                   (- 255 (cadr dstCol1)) (- 255 (cadr dstCol2)))
      (gimp-levels layer HISTOGRAM-BLUE (caddr srcCol1) (caddr srcCol2) 1.0
                   (- 255 (caddr dstCol1)) (- 255 (caddr dstCol2)))
      (gimp-levels layer HISTOGRAM-VALUE 0 255 1.0 255 0)
      ))

Note that gimp-levels order is important.  Also, I had to reverse the destination range, then invert the color value to obtain the same results as original mapcolor.
Comment 4 Eric Lamarque 2008-11-01 23:29:12 UTC
I was not satisfied with the previous solution : in my comprehension of gimp-levels, no color inversion should be necessary, and it isn't.

Now, I can probably use this in script-fu. mapcolor can also be reintroduced implemented through gimp-levels.

Comment 5 Eric Lamarque 2008-11-02 21:34:35 UTC
Created attachment 121832 [details]
mapcolor plug-in implemented through gimp-levels

I solve the preview issue by creating a temporary image for each preview invalidate. Not optimal, but it seems to work.
Comment 6 Sven Neumann 2008-11-18 22:41:48 UTC
My idea was more to add a function to Script-Fu that provides the functionality of the removed PDB procedure under the name plug-in-color-map() and implements it by means of gimp-levels. Basically the code from comment #3 added to scripts/script-fu-compat.init (or perhaps better to a new file plug-in-compat.init).
Comment 7 Sven Neumann 2008-11-18 23:12:53 UTC
Created attachment 122993 [details] [review]
patch adding a compat function to script-fu

The attached patch resurrects the functionality of the Aurora Borealis script and other scripts using the plug-in-color-map procedure.
Comment 8 Sven Neumann 2008-11-19 08:18:38 UTC
Committed to both branches (with a minor change):

2008-11-19  Sven Neumann  <sven@gimp.org>

	Bug 558454 – Plugin Map Color Range disapears from GIMP

	* plug-ins/script-fu/scripts/Makefile.am

	* plug-ins/script-fu/scripts/plug-in-compat.init: new file
	providing compatibility with plug-ins from older GIMP
	versions. Contains a reimplementation of plug-in-color-map based
	on ideas and code from Eric Lamarque.

	* plug-ins/script-fu/scheme-wrapper.c (tinyscheme_init): load the
	plug-in-compat.init file.