Page 1 of 1
Posted: 2006-10-20T13:01:57-07:00
by magick
Try
- convert input.tga +matte -resize 50% output.tga
to remove the alpha channel.
Posted: 2006-10-20T16:49:09-07:00
by magick
It seems your alpha channel is inverted. Try displaying the image with Gimp it produces the same results as ImageMagick. You could try -channel A -negate to correct the problem.
Posted: 2006-10-20T18:41:54-07:00
by magick
We're using ImageMagick 6.3.0 and this command seems to produce what you're looking for:
- convert \( Asimov.tga +matte -resize 50% \) \( Asimov.tga -fx a -resize 50% \) -compose CopyOpacity -composite image.tga
Posted: 2006-10-21T17:17:17-07:00
by magick
ImageMagick resizing uses unassociated alpha when the matte channel is active. In your case your alpha channel is not really alpha values so we inactivate the alpha channel with the +matte option and deal with the alpha channel separately.
Posted: 2006-10-22T21:00:26-07:00
by anthony
An alturnative that may be easier is to use the new multi-image
-separate option. This will separate an image into a list of gray scale images on per channel. This makes it useful to disconnect any color-alpha relationship that may be involved. Remember more options with IM are applied to ALL images in a image sequence.
Code: Select all
convert Asimov.tga -channel RGBA -separate -resize 50% -combine image.tga
Posted: 2006-10-23T19:12:50-07:00
by anthony
Hmmm after trying this myself I found that using -separate on your image produces four images, but each still contained the alpha channel!!!!! I think that may have been an unexpected feature, and in this case unwanted.
Adding a +matte after the -separate fixed the problem.
Code: Select all
convert Asimov.tga -channel RGBA -separate +matte -resize 50% -combine image.tga
I'll update the IM Examples page about -separate to make note of this.
Posted: 2006-10-24T21:19:51-07:00
by anthony
Should be much faster on larger images. -fx has to interpriate the mathematical argument it is given once for every pixel and color channel involved. -separate just does the job directly.