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.
The GIMP correct (i.e. desired) output, it used to work the same with GEGL.
The current GEGL incorrect output.
Environment and Versions:
- Ubuntu 12.04
- Babl 0.1.10 (this one from ftp)
- Gegl 0.2.0 (this one from ftp)
- Other packages from Ubuntu 12.04 repository:
- libgdk-pixbuf2.0-dev
- imagemagick
- libpng12-dev
- libpango1.0-dev
- intltool
- libjpeg8-dev
- libgdk-pixbuf2.0-dev
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
- I tried to uninstall the gegl and babl that comes with GIMP 2.8, but still, gegl don't work properly.
- Check the answer, I did solve it while writing this question.