开发者

Easily strip alpha channel from images in Mathematica

开发者 https://www.devze.com 2023-02-24 07:29 出处:网络
What 开发者_开发技巧is the simplest way to strip the alpha channel (and possible convert images to greyscale) in Mathematica?

What 开发者_开发技巧is the simplest way to strip the alpha channel (and possible convert images to greyscale) in Mathematica?

I would like to use ImageAssemble, but some of the images come with and some without an alpha channel. Is there a simpler built-in way than manipulating the ImageData directly?


The RemoveAlphaChannel function will do this.


For Mathematica 7, I believe this works:

ColorCombine@Most@ColorSeparate@# &

It's not robust at this point, but type checking could be added.


Your second question (not sure it is) conversion to grayscale, is done with:

ColorConvert[image, "Grayscale"]
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号