How to remove background color.
How to remove background color.
Dear Friend,
I had successfully cropped portion of image. This cropped image contain light green background and maroon color.
I want to remove green background & keep text as it is. Also please note that background color & text color should be different for each cropped image.
Please guide me. Thanks in advance.
Snowby Dave
I had successfully cropped portion of image. This cropped image contain light green background and maroon color.
I want to remove green background & keep text as it is. Also please note that background color & text color should be different for each cropped image.
Please guide me. Thanks in advance.
Snowby Dave
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to remove background color.
One technique for solid color on solid color is convert the text into a mask. turning the outside color balck and the inside white.
text - > greyscale -> normalize.
now negate if needed to make the inside white and outside black.
One whay is grab pixel 0,0, expand to a overlay canvas and overlay using
'difference' . A white pixel at 0,0 will negate the image, a black will leave it alone!
See Compose 'Difference'...
http://www.imagemagick.org/Usage/compose/#difference
You now have a mask, which you can use to select color and or image overlays.
http://www.imagemagick.org/Usage/channels/#masks
text - > greyscale -> normalize.
now negate if needed to make the inside white and outside black.
One whay is grab pixel 0,0, expand to a overlay canvas and overlay using
'difference' . A white pixel at 0,0 will negate the image, a black will leave it alone!
See Compose 'Difference'...
http://www.imagemagick.org/Usage/compose/#difference
You now have a mask, which you can use to select color and or image overlays.
http://www.imagemagick.org/Usage/channels/#masks
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: How to remove background color.
Dear Anthony,
Kindly thans for your prompt reponse. Well I am using MagickWand. I am not using ImageMagick.
I think MagickWand & ImageMagick both are different. I don't have any idea about how to handle ImageMagick with PHP.
My localhost has Win XP and live serer has Linux. I am working on PHP 5.2
Is there is any function which will removed background with MagickWand object. Please guide me or tell me each function step by step so I can do that.
Thanking you once again.
Snowby Dave
Kindly thans for your prompt reponse. Well I am using MagickWand. I am not using ImageMagick.
I think MagickWand & ImageMagick both are different. I don't have any idea about how to handle ImageMagick with PHP.
My localhost has Win XP and live serer has Linux. I am working on PHP 5.2
Is there is any function which will removed background with MagickWand object. Please guide me or tell me each function step by step so I can do that.
Thanking you once again.
Snowby Dave
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to remove background color.
They are not that different, both use the MagickCore underlying library. One is just a command line interface, the other an application interface. What you do in one you CAN do in the other (somehow). If you can't then you have a bug that should be rectified.
Now while I can help out in general ways for MagickWand (because they are simular) I can not give you the exact commands to use, I am not that familure with the API.
Now if someone else on this list can encode the above method into MagickWand, then you are in business, or try it yourself.
Now while I can help out in general ways for MagickWand (because they are simular) I can not give you the exact commands to use, I am not that familure with the API.
Now if someone else on this list can encode the above method into MagickWand, then you are in business, or try it yourself.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: How to remove background color.
Hello,
searching in the MagickWand manual i found following function:
http://www.magickwand.org/MagickSetImag ... Color.html
Maybe you can use this statement to remove background color by setting it to white or something else.
squig
searching in the MagickWand manual i found following function:
http://www.magickwand.org/MagickSetImag ... Color.html
Maybe you can use this statement to remove background color by setting it to white or something else.
squig
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to remove background color.
The MagickSet commands are equivelent to the command line settings options, they only set options onto the current image sequence (wand) for use by later options.
in other words. MagickSetImageBackgroundColor() just sets background for later image creation and operators. It does not set or change an images background itself!
in other words. MagickSetImageBackgroundColor() just sets background for later image creation and operators. It does not set or change an images background itself!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: How to remove background color.
Dear Anthony,
You are 100% rights MagickSetImageBackgroundColor() will only set Background color, but it will not change it.
Before many days I had already tired this. Regarding command line interface I will try it.
Anthony do you have any idea about good book on MagickWand. In which sample application given with application api ? Please suggest if you know any book. Because I have to also fix red eye, text vertical alignment.
Thanking you,
Snowby Dave
You are 100% rights MagickSetImageBackgroundColor() will only set Background color, but it will not change it.
Before many days I had already tired this. Regarding command line interface I will try it.
Anthony do you have any idea about good book on MagickWand. In which sample application given with application api ? Please suggest if you know any book. Because I have to also fix red eye, text vertical alignment.
Thanking you,
Snowby Dave
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to remove background color.
Sorry no. ImageMagick are tools and while many people have probably implements such things in imagemagick, no one has shared them. the one red eye tool I have seen (a web client, I don't rememebr the URL) was a manual eye selection. A automatic eye finding function is probably only in research publications and commercial applications.
This was one reason I work so diligently on IM Examples. So that when someone does contribute a method or technique I can capture it for others to use.
This was one reason I work so diligently on IM Examples. So that when someone does contribute a method or technique I can capture it for others to use.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: How to remove background color.
Respected Anthony,
Thanks for your reply. I can understand that it is very hard to fixed red eye.
OK Anthony as you know that I am new with ImageMagick & MagickWand. Will you please give me any one simple example of ImageMagick with PHP. So I will start to implement it in my application.
Also will you please tell me which one is better either ImageMagick or MagickWand ?
Thanking you,
Snowby Dave
Thanks for your reply. I can understand that it is very hard to fixed red eye.
OK Anthony as you know that I am new with ImageMagick & MagickWand. Will you please give me any one simple example of ImageMagick with PHP. So I will start to implement it in my application.
Also will you please tell me which one is better either ImageMagick or MagickWand ?
Thanking you,
Snowby Dave
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to remove background color.
Examples can be found in lots of places. Basic 'test if it works' examples for all 3 PHP methods are in the feedback area of IM Examples.
http://www.imagemagick.org/Usage/feedback/#php
More can be found in the IM forums, (search for NewMagickWand)
Also from my bookmarks...
Create Dynamic Images with ImageMagick [PHP & MySQL Tutorials]
http://www.sitepoint.com/article/dynami ... magemagick
PHP ImageMagick MagickWand Examples @ IONCANNON
http://www.ioncannon.net/php/61/php-ima ... -examples/
I am sure there are more.
http://www.imagemagick.org/Usage/feedback/#php
More can be found in the IM forums, (search for NewMagickWand)
Also from my bookmarks...
Create Dynamic Images with ImageMagick [PHP & MySQL Tutorials]
http://www.sitepoint.com/article/dynami ... magemagick
PHP ImageMagick MagickWand Examples @ IONCANNON
http://www.ioncannon.net/php/61/php-ima ... -examples/
I am sure there are more.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to remove background color.
Examples can be found in lots of places. Basic 'test if it works' examples for all 3 PHP methods are in the feedback area of IM Examples.
http://www.imagemagick.org/Usage/feedback/#php
More can be found in the IM forums, (search for NewMagickWand)
Also from my bookmarks...
Create Dynamic Images with ImageMagick [PHP & MySQL Tutorials]
http://www.sitepoint.com/article/dynami ... magemagick
PHP ImageMagick MagickWand Examples @ IONCANNON
http://www.ioncannon.net/php/61/php-ima ... -examples/
I am sure there are more, that others can provide links to.
http://www.imagemagick.org/Usage/feedback/#php
More can be found in the IM forums, (search for NewMagickWand)
Also from my bookmarks...
Create Dynamic Images with ImageMagick [PHP & MySQL Tutorials]
http://www.sitepoint.com/article/dynami ... magemagick
PHP ImageMagick MagickWand Examples @ IONCANNON
http://www.ioncannon.net/php/61/php-ima ... -examples/
I am sure there are more, that others can provide links to.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to remove background color.
Examples can be found in lots of places. Basic 'test if it works' examples for all 3 PHP methods are in the feedback area of IM Examples.
http://www.imagemagick.org/Usage/feedback/#php
More can be found in the IM forums, (search for NewMagickWand)
Also from my bookmarks...
Create Dynamic Images with ImageMagick [PHP & MySQL Tutorials]
http://www.sitepoint.com/article/dynami ... magemagick
PHP ImageMagick MagickWand Examples @ IONCANNON
http://www.ioncannon.net/php/61/php-ima ... -examples/
I am sure there are more, that others can provide links to.
http://www.imagemagick.org/Usage/feedback/#php
More can be found in the IM forums, (search for NewMagickWand)
Also from my bookmarks...
Create Dynamic Images with ImageMagick [PHP & MySQL Tutorials]
http://www.sitepoint.com/article/dynami ... magemagick
PHP ImageMagick MagickWand Examples @ IONCANNON
http://www.ioncannon.net/php/61/php-ima ... -examples/
I am sure there are more, that others can provide links to.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/