Setting some background color in gifs

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
IamBGthegreat
Posts: 7
Joined: 2016-09-25T10:33:52-07:00
Authentication code: 1151

Setting some background color in gifs

Post by IamBGthegreat »

I'm setting some background color in some of my gifs. But this problem occurs, it doesn't fill the whole background.

The problem: http://imgur.com/a/Yaipm

Original image: http://imgur.com/a/kbgEL


I'm running on windows 10, here's the code that I used:

Code: Select all

convert .gif -transparent white .gif
Then after that:

Code: Select all

convert .gif -fill green1 -opaque none .gif



Any solutions on how to solve this problem? I've been into this since last week.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Setting some background color in gifs

Post by fmw42 »

Your white is not pure white, so you need to add -fuzz XX%

Code: Select all

convert test.gif -fuzz 10% -transparent "white" result.gif
IamBGthegreat
Posts: 7
Joined: 2016-09-25T10:33:52-07:00
Authentication code: 1151

Re: Setting some background color in gifs

Post by IamBGthegreat »

fmw42 wrote:Your white is not pure white, so you need to add -fuzz XX%

Code: Select all

convert test.gif -fuzz 10% -transparent "white" result.gif

Hey, thanks for helping me. Here's the result with the fuzz: http://imgur.com/a/76VSI


Then I add the this code again:

Code: Select all

convert .gif -fill green1 -opaque none .gif
http://imgur.com/a/u8ejt Final result
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Setting some background color in gifs

Post by GeeMack »

IamBGthegreat wrote:I'm setting some background color in some of my gifs. But this problem occurs, it doesn't fill the whole background.
Try something like this...

Code: Select all

convert original.gif -coalesce -background green1 -alpha remove output.gif
That should lay the entire animation onto a green background. That "-coalesce" operation is what makes it fill the whole background on every frame.
IamBGthegreat
Posts: 7
Joined: 2016-09-25T10:33:52-07:00
Authentication code: 1151

Re: Setting some background color in gifs

Post by IamBGthegreat »

GeeMack wrote:
IamBGthegreat wrote:I'm setting some background color in some of my gifs. But this problem occurs, it doesn't fill the whole background.
Try something like this...

Code: Select all

convert original.gif -coalesce -background green1 -alpha remove output.gif
That should lay the entire animation onto a green background. That "-coalesce" operation is what makes it fill the whole background on every frame.

Woahhh!! It worked! Thank you so much my friend :)


Here is the result: http://imgur.com/a/c5AyW
Post Reply