Jacobian
Jacobian

Reputation: 10802

Unable to copy alpha channel using ImageMagick

I have two tif images - input.tif and test.tif - and what I want to achieve is apply alpha channel of the first image to the second one. This is what I do now, using ImageMagick:

C:\Images> magick input.tif -alpha extract alpha.pgm
C:\Images> magick test.tif alpha.pgm -compose copyalpha -composite output.tif

When, however, I try to open output.tif, I get a message that the image is corrupt.

Upvotes: 0

Views: 599

Answers (1)

fmw42
fmw42

Reputation: 53081

try adding -alpha off in your second command

C:\Images> magick input.tif -alpha extract alpha.pgm
C:\Images> magick test.tif alpha.pgm -alpha off -compose copy_opacity -composite output.tif

Or you can do it in one command as:

C:\Images> magick test.tif ( input.tif -alpha extract ) -alpha off -compose copy_opacity -composite output.tif

Upvotes: 3

Related Questions