GNOME Bugzilla – Bug 558454
Plugin Map Color Range disappears from GIMP
Last modified: 2008-11-30 14:18:46 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?
We could add it back w/o registering a menu entry.
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?
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.
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.
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.
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).
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.
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.