Page 1 of 1

Converting RGB color to transparent

Posted: 2016-06-29T11:46:38-07:00
by BajungaDustin
I have a series of Images i need to turn into a gif with transparent background.

When i try to convert the RGB it does nothing.

when i do

Code: Select all

>Convert 00*.png -transparent -fill "rgb(0,255,0)" test.png
i get

Code: Select all

Convert: unrecognized color `-fill' @ warning/color.c/GetColorCompliance/1045.
Convert: unable to open image 'rgb(0,255,0)': No such file or directory @ error/blob.c/OpenBlob/2695.
Convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/508.
When i try

Code: Select all

>convert -fill "rgb(0,255,0)" +transparent 00*.png test.png
i get

Code: Select all

convert: no images defined `test.png' @ error/convert.c/ConvertImageCommand/3235.
im not real good with this program and only have to use it a few times a year seems like. But im recently setting up some stream alerts for a friend and cant get the green background to go away. And yes it is a perfect 0,255,0 but im not sure if i am laying the commands out correctly.

Any help would be great.

Re: Converting RGB color to transparent

Posted: 2016-06-29T12:09:29-07:00
by fmw42
convert 00*.png -transparent "rgb(0,255,0)" test.png

Re: Converting RGB color to transparent

Posted: 2016-06-29T16:15:53-07:00
by BajungaDustin
fmw42 wrote:convert 00*.png -transparent "rgb(0,255,0)" test.png
didnt work.. still green

Image

Re: Converting RGB color to transparent

Posted: 2016-06-29T16:44:56-07:00
by fmw42
You probably do not have pure green. As I measure it, it is rgb(11, 253, 9) and not rgb(0,255,0), So add -fuzz XX% before -transparent. Find the smallest % that works adequately. Since you have antialiasing in your image so that the green mixes with the outline of your small images, you will need a fairly substantial fuzz value. This seems to work, but you may want to tune it more.

Code: Select all

convert test.png -fuzz 30% -transparent green1 result.png

Re: Converting RGB color to transparent

Posted: 2016-06-29T22:24:47-07:00
by BajungaDustin
fmw42 wrote:You probably do not have pure green. As I measure it, it is rgb(11, 253, 9) and not rgb(0,255,0), So add -fuzz XX% before -transparent. Find the smallest % that works adequately. Since you have antialiasing in your image so that the green mixes with the outline of your small images, you will need a fairly substantial fuzz value. This seems to work, but you may want to tune it more.

Code: Select all

convert test.png -fuzz 30% -transparent green1 result.png

Ok so that worked but it gave me a bad result

Image

Will more fuzz reduce the amount of green left around the edges of the model? or less fuzz?

Re: Converting RGB color to transparent

Posted: 2016-06-29T22:38:55-07:00
by fmw42
You need a larger fuzz value. The fuzz value is how close to your color you want to remove. 0% will remove only the exact color. A larger value will remove colors further from your specified color.

Re: Converting RGB color to transparent

Posted: 2016-06-29T23:26:02-07:00
by BajungaDustin
fmw42 wrote:You need a larger fuzz value. The fuzz value is how close to your color you want to remove. 0% will remove only the exact color. A larger value will remove colors further from your specified color.
Awesome.. Thank you