Hi,
I want to create a mask image. I want to use an alpha channel as a mask but I don't know how to get an alpha channel from a png image in perl script. I am new in perl and ImageMagick, Can somebody help?
How to get an alpha channel from a png
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to get an alpha channel from a png
Just extract the alpha channel. look for separate in the perlmagick docs
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: How to get an alpha channel from a png
Separate works, thanks, but I still have a problem when converting this mask to bmp,
I have a png image and I want to have a 8bit grayscale bmp mask and 24bit bmp image, I try this to create the mask
convert image.png -channel matte -negate -separate mask.bmp
output mask.bmp has 1-bit alpha channel, later when I build from this bmp symbian mbm file I get horrible effect. How to remove this 1-bit alpha channel from output bmp image??? I tried to add -type TrueColor
convert image.png -channel matte -negate -separate -type TrueColor mask.bmp
but it didn't change anything, can someone help, it is very important for me now
I have a png image and I want to have a 8bit grayscale bmp mask and 24bit bmp image, I try this to create the mask
convert image.png -channel matte -negate -separate mask.bmp
output mask.bmp has 1-bit alpha channel, later when I build from this bmp symbian mbm file I get horrible effect. How to remove this 1-bit alpha channel from output bmp image??? I tried to add -type TrueColor
convert image.png -channel matte -negate -separate -type TrueColor mask.bmp
but it didn't change anything, can someone help, it is very important for me now
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to get an alpha channel from a png
To remove the alpha from the image use Evaluate to set the alpha mask to opaque. or just turn off the 'matte' channel.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: How to get an alpha channel from a png
I added +matte option to remove alpha channel from output image:
convert image.png -channel matte -negate -separate +matte -depth 8 mask.bmp
I still get mask.bmp with 1bit alpha channel, its type is Gra yScaleMatte, why?
I also tried to add -type Grayscale to this command but I always get GrayScaleMatte with this 1bit alpha channel.
Can You write me how to remove this alpha channel with -evaluate option?
convert image.png -channel matte -negate -separate +matte -depth 8 mask.bmp
I still get mask.bmp with 1bit alpha channel, its type is Gra yScaleMatte, why?
I also tried to add -type Grayscale to this command but I always get GrayScaleMatte with this 1bit alpha channel.
Can You write me how to remove this alpha channel with -evaluate option?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to get an alpha channel from a png
Sounds to me like the BMP code always adds it. have you tried one of the other BMP formats.
List all formats with
In my list I see BMP2 and BMP3 as alturnatives.
List all formats with
Code: Select all
convert -list format
Code: Select all
convert image.png -channel matte -negate -separate +matte -depth 8 bmp3:image.bmp
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: How to get an alpha channel from a png
This works! Hurra hurra! alpha channel has been removed from mask.bmp,
great great great thanks!
great great great thanks!