Page 1 of 1

Transform white background to transparency

Posted: 2008-07-18T06:44:37-07:00
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

Re: Transform white background to transparency

Posted: 2008-07-18T14:32:56-07:00
by yyyy273
convert input.bmp bgnd.png -compose ChangeMask -composite output.png

bgnd.png is a solid white picture.

Re: Transform white background to transparency

Posted: 2008-07-20T01:41:49-07:00
by imagetester
Thanks man that really helped !

Re: Transform white background to transparency

Posted: 2008-07-20T08:13:31-07:00
by imagetester
But is there any way to write it in c++ using Magick++?!

Re: Transform white background to transparency

Posted: 2008-07-20T09:47:12-07:00
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

Re: Transform white background to transparency

Posted: 2008-07-21T04:09:22-07:00
by imagetester
Thanks again, ImageMagick is really powerful