Transform white background to transparency

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
imagetester

Transform white background to transparency

Post by imagetester »

Hi i need to use the function MeanErrorPerPixel() in the magick++ library.
But it is giving a wrong comparison due to the white background.
I thought i could have a more precise result if i remove the white background of my logos.
Is their any way to do it with this library, i can't process this talk for each image because there are thousands of images.

I think their is a way by transforming the image to .png.

Any solution? thanks in advance
yyyy273

Re: Transform white background to transparency

Post by yyyy273 »

convert input.bmp bgnd.png -compose ChangeMask -composite output.png

bgnd.png is a solid white picture.
imagetester

Re: Transform white background to transparency

Post by imagetester »

Thanks man that really helped !
imagetester

Re: Transform white background to transparency

Post by imagetester »

But is there any way to write it in c++ using Magick++?!
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Transform white background to transparency

Post by el_supremo »

See transparentImage in http://www.imagemagick.org/Magick++/STL.html
Just below that section is example code which shows how to change red to transparent in a GIF animation.

Pete
imagetester

Re: Transform white background to transparency

Post by imagetester »

Thanks again, ImageMagick is really powerful
Post Reply