简体   繁体   中英

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.

输入

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

GIMP输出

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

  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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM