Alpha channel problem

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
studio4
Posts: 2
Joined: 2013-11-11T03:59:03-07:00
Authentication code: 6789

Alpha channel problem

Post by studio4 »

Hello,

I've tried to search the forums for a similar problem but everything I've found so far are examples of commands to create the image I am looking for not similar issues to mine.

I'm running "Version: ImageMagick 6.5.4-7 2012-05-07 Q16 OpenMP" on CentOS 6.4 installed using YUM from the main repository. Most command line functions work really well but I don't seem to be able to create any images with an alpha channel. When trying to create a gradient with full transparency through to opaque black using the following command:

Code: Select all

convert -size 30x500 gradient:"black-none" -rotate 90 gradient_transparent.png
I get a solid black image with a 1 pixel white line along the bottom.

I installed ImageMagick with the following command:

Code: Select all

yum install ImageMagick-devel ImageMagick ImageMagick-perl 
identify -list configure looks like this:

Code: Select all

Name          Value
-------------------------------------------------------------------------------
CC            gcc -std=gnu99
CFLAGS        -fopenmp -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wall -W -pthread
CONFIGURE     ./configure  '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix                            =/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--locals                            tatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-shared' '--disable-static' '--with-modules' '--with-perl' '--with-x' '--w                            ith-threads' '--with-magick_plus_plus' '--with-gslib' '--with-wmf' '--with-lcms' '--with-rsvg' '--with-xml' '--with-perl-options=INSTALLDIRS=vendor  CC='\''gcc -L/builddir/build/B                            UILD/ImageMagick-6.5.4-7/magick/.libs'\'' LDDLFLAGS='\''-shared -L/builddir/build/BUILD/ImageMagick-6.5.4-7/magick/.libs'\''' '--without-dps' '--without-included-ltdl' '--with-ltd                            l-include=/usr/include' '--with-ltdl-lib=/usr/lib64' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'target_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2                             -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexcepti                            ons -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
COPYRIGHT     Copyright (C) 1999-2009 ImageMagick Studio LLC
CPPFLAGS      -I/usr/include/ImageMagick
CXX           g++
CXXFLAGS      -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wall -W -pthread
DEFS          -DHAVE_CONFIG_H
DELEGATES     bzlib fontconfig freetype gs jpeg jng jp2 lcms png rsvg tiff x11 xml wmf zlib
DISTCHECK_CONFIG_FLAGS 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --disable-deprecated --with                            -quantum-depth=16 --with-umem=no --with-autotrace=no --with-dps=no --with-fontpath=
EXEC-PREFIX   /usr
HOST          x86_64-redhat-linux-gnu
LDFLAGS       -L/usr/lib64 -lfreetype
LIB_VERSION   0x654
LIB_VERSION_NUMBER 6,5,4,7
LIBS          -lMagickCore -llcms -ltiff -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lm -lgomp -lpthread -lltdl
NAME          ImageMagick
PCFLAGS       -fopenmp
PREFIX        /usr
QuantumDepth  16
RELEASE_DATE  2012-05-07
VERSION       6.5.4
WEBSITE       http://www.imagemagick.org
Any idea what's going on? Am I missing a dependency?

I realise I'm not running the latest version of ImageMagick but surely there should be alpha support in the version I'm using?

Thanks
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Alpha channel problem

Post by snibgo »

That's a very old version -- 4 years old. The oldest I have is v6.5.8, on Windows 7. Your command work fine on that version. You don't need quotes around the colours, but it works with or without.

I suggest you upgrade. Workarounds may be possible for your old version, but life would be a pain.
snibgo's IM pages: im.snibgo.com
studio4
Posts: 2
Joined: 2013-11-11T03:59:03-07:00
Authentication code: 6789

Re: Alpha channel problem

Post by studio4 »

Hello snibgo,

Thank you for your reply. I was reading where it says in the version output "2012-05-07" and thought I wasn't that behind the curve but you're absolutely right - 4 years is a long time.

To get this working properly I:
  • removed the previously installed version of ImageMagick with yum
    installed the ELEL & REMI repos
    Installed ImageMagick and dependancies
    Disabled extra repos


Everything ticking along nicely now.

Hope this helps someone else.

Thanks
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Alpha channel problem

Post by snibgo »

Good stuff.

The date given is the compilation date. It might be more useful and less confusing if it announced the release date of the source code.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Alpha channel problem

Post by fmw42 »

snibgo wrote:Good stuff.

The date given is the compilation date. It might be more useful and less confusing if it announced the release date of the source code.

I believe convert -version provides the release date.
Post Reply