How to remove the alpha channel during convert

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
matthias-ronge
Posts: 3
Joined: 2015-08-06T05:17:15-07:00
Authentication code: 1151

How to remove the alpha channel during convert

Post by matthias-ronge »

I am trying to position an image on a background and add some text to it.

Code: Select all

convert in.png -background #cccccc -extent 500x150-25-25 -gravity center -annotate 0 "some text" out.tif
in.png is an image of solid colour which uses the alpha channel to create the visible image (imagine something cut out of color paper). The result is what I want it to be, except for the fact that the output tif has got an alpha channel. I tried all of the -alpha commands, such as

Code: Select all

convert in.png -background #cccccc -alpha remove -extent 500x128-32-32 -gravity center -annotate 0 "some text" out.tif
and also -alpha off which is not listed in that documentation, even combined two -alpha commands, but any of the out.tif files still have got an alpha channel when opening it in GIMP. Which is the way to create a 3x8 bit color tiff without alpha channel from an input image that has got alpha channel, such that the visible pixels remain and the transparent pixels are replaced by the given background color?

ImageMagick version: ImageMagick 6.8.6-8 2013-08-04 Q16
Environment: Windows 7 Ultimate, 64 bit
Usage: from prompt (cmd.exe)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to remove the alpha channel during convert

Post by snibgo »

I suppose the final action you want is to switch alpha off, so put that at the end of the command, just before the output filename.
snibgo's IM pages: im.snibgo.com
matthias-ronge
Posts: 3
Joined: 2015-08-06T05:17:15-07:00
Authentication code: 1151

Re: How to remove the alpha channel during convert

Post by matthias-ronge »

This works. :)
Post Reply