bashimage-processingubuntu-12.04gimpgegl

Gegl color-to-alpha does not remove the white color like GIMP does


Color to Alpha

The color-to-alpha operation is when a color is taken from all the pixels in the image and converted to transparent, this is especially useful to extract hand written or free drawing from a fully white paper.

The Command Line

Below is basic GEGL code to convert the white color to alpha, it used to work on Ubuntu 12.04, but after re-installing it, it looks like there is bug in GEGL.

I'm not sure what the previous setup was but the command line is mostly the same:

~/gegl/bin/gegl --xml '
<?xml version="1.0" encoding="UTF-8"?>
<gegl>
    <node operation="gegl:color-to-alpha">
    <params>
        <param name="color">white</param>
    </params>
    </node>    
    <node operation="gegl:load" id="clone0">
        <params>
            <param name="path">input.png</param>
        </params>
    </node>
</gegl>
' --output gegl-output.png

Example on the Operation and the Gegl Error

The input image being used.

Input

The GIMP correct (i.e. desired) output, it used to work the same with GEGL.

GIMP Output

The current GEGL incorrect output.

enter image description here

Environment and Versions:

The gegl and babl are installed using the following command lines, because GIMP 2.8 is also installed and using another version of GEGL:

$ tar -jxvf babl-0.1.10.tar.bz2
$ cd babl-0.1.10/
$ ./configure --prefix=$HOME/gegl
$ make
$ make install
$ export PKG_CONFIG_PATH="$HOME/gegl/lib/pkgconfig"
$ cd ..
$ tar -jxvf gegl-0.2.0.bz2
$ cd gegl-0.2.0/
$ ./configure --prefix=$HOME/gegl
$ make
$ make install

Note: he images are best to be opened with GIMP to see the alpha Chanel.

What I Have Tried

  1. I tried to uninstall the gegl and babl that comes with GIMP 2.8, but still, gegl don't work properly.
  2. Check the answer, I did solve it while writing this question.

Solution

  • Install babl and gegl from their git repo. git://git.gnome.org/babl and git://git.gnome.org/gegl. It solved the problem (most probably a gegl bug).