# Web graphics experts.  Possible to specify a colour as the transparency in a gif?

**URL:** https://boards.straightdope.com/t/web-graphics-experts-possible-to-specify-a-colour-as-the-transparency-in-a-gif/492584
**Category:** Factual Questions
**Created:** [April 9, 2009, 11:31pm UTC](https://boards.straightdope.com/t/web-graphics-experts-possible-to-specify-a-colour-as-the-transparency-in-a-gif/492584 "2009-04-09T23:31:36Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Lobsang](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lobsang/32/4067_2.png) [@Lobsang](https://boards.straightdope.com/u/Lobsang)
#### Post date: [April 9, 2009, 11:31pm UTC](https://boards.straightdope.com/t/web-graphics-experts-possible-to-specify-a-colour-as-the-transparency-in-a-gif/492584/1 "2009-04-09T23:31:36Z")

</div>

I have an animated gif which has a black background.

Without editing the gif itself is it possible to set the black as the transparency? So that on a page who’s background is non-black the black parts of the gif are replaced by the colour of the page’s background?

---

<div class="post-metadata">

### Author: ![Nicest\_of\_the\_Damned](https://avatars.discourse-cdn.com/v4/letter/n/8baadc/32.png) [@Nicest\_of\_the\_Damned](https://boards.straightdope.com/u/Nicest_of_the_Damned)
#### Post date: [April 10, 2009, 12:07am UTC](https://boards.straightdope.com/t/web-graphics-experts-possible-to-specify-a-colour-as-the-transparency-in-a-gif/492584/2 "2009-04-10T00:07:42Z")

</div>

I have an oldish version of Paint Shop Pro (version 7) that allows you to save a gif and set which color will be transparent. I think it doesn’t blend the edges as well if you do it that way though, so it might still look a little wonky.

There might be freeware programs that would do the same thing but I am afraid I don’t know of a specific one.

---

<div class="post-metadata">

### Author: ![eldowan](https://avatars.discourse-cdn.com/v4/letter/e/848f3c/32.png) [@eldowan](https://boards.straightdope.com/u/eldowan)
#### Post date: [April 10, 2009, 1:00am UTC](https://boards.straightdope.com/t/web-graphics-experts-possible-to-specify-a-colour-as-the-transparency-in-a-gif/492584/3 "2009-04-10T01:00:31Z")

</div>

> [@Lobsang](#):
>
> I have an animated gif which has a black background.
> 
> Without editing the gif itself is it possible to set the black as the transparency? So that on a page who’s background is non-black the black parts of the gif are replaced by the colour of the page’s background?

I think if you make the gif so the black is transparent, by definition that _is_ editing the file.

That said, yes it should be possible and relatively easy to do.  
If you don’t have any other graphics programs available to you, you can try gimp out. It should be able to handle that task fine.

---

<div class="post-metadata">

### Author: ![Reply](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/reply/32/15952_2.png) [@Reply](https://boards.straightdope.com/u/Reply)
#### Post date: [April 10, 2009, 2:08am UTC](https://boards.straightdope.com/t/web-graphics-experts-possible-to-specify-a-colour-as-the-transparency-in-a-gif/492584/4 "2009-04-10T02:08:02Z")

</div>

> [@Lobsang](#):
>
> I have an animated gif which has a black background.
> 
> Without editing the gif itself is it possible to set the black as the transparency? So that on a page who’s background is non-black the black parts of the gif are replaced by the colour of the page’s background?

Short answer is no, you have to edit the GIF itself to specify a transparent color.

Long answer… uh, in theory maybe you could do some fancy JavaScript/Java/Flash programming to overlay the background color on top of the correct parts of your GIF… but that’d be utterly stupid. Is there a reason you can’t edit the GIF?

---

<div class="post-metadata">

### Author: ![Reply](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/reply/32/15952_2.png) [@Reply](https://boards.straightdope.com/u/Reply)
#### Post date: [April 10, 2009, 2:09am UTC](https://boards.straightdope.com/t/web-graphics-experts-possible-to-specify-a-colour-as-the-transparency-in-a-gif/492584/5 "2009-04-10T02:09:08Z")

</div>

> [@Nicest\_of\_the\_Damned](#):
>
> I have an oldish version of Paint Shop Pro (version 7) that allows you to save a gif and set which color will be transparent. I think it doesn’t blend the edges as well if you do it that way though, so it might still look a little wonky.
> 
> There might be freeware programs that would do the same thing but I am afraid I don’t know of a specific one.

If I remember correctly, PSP7 lets you choose a color closest to the actual background color and will then dither the transparency to make it more seamless.

---

<div class="post-metadata">

### Author: ![sailor](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@sailor](https://boards.straightdope.com/u/sailor)
#### Post date: [April 10, 2009, 6:48am UTC](https://boards.straightdope.com/t/web-graphics-experts-possible-to-specify-a-colour-as-the-transparency-in-a-gif/492584/6 "2009-04-10T06:48:58Z")

</div>

An animated GIF is composed of a number of individual GIFs. I am guessing you will have to edit the palette of each and every single frame to define the transparent color. . I do not think it can be done globally for all frames but I could be wrong.

---

<div class="post-metadata">

### Author: ![Nicest\_of\_the\_Damned](https://avatars.discourse-cdn.com/v4/letter/n/8baadc/32.png) [@Nicest\_of\_the\_Damned](https://boards.straightdope.com/u/Nicest_of_the_Damned)
#### Post date: [April 10, 2009, 9:57am UTC](https://boards.straightdope.com/t/web-graphics-experts-possible-to-specify-a-colour-as-the-transparency-in-a-gif/492584/7 "2009-04-10T09:57:15Z")

</div>

> [@sailor](#):
>
> An animated GIF is composed of a number of individual GIFs. I am guessing you will have to edit the palette of each and every single frame to define the transparent color. . I do not think it can be done globally for all frames but I could be wrong.

After I posted I caught that it was animated. PSP7 has an animation program (Animation Shop) that allows you to set a transparency color for the entire sequence. But yeah, you will need a program that can work with animated gifs.

> [@Reply](#):
>
> If I remember correctly, PSP7 lets you choose a color closest to the actual background color and will then dither the transparency to make it more seamless.

That’s true, there is a “blend with background color” you can choose when optimizing the gif that would probably help. But the image may already be blended to the original background color so I think you might still get some residual wonkiness, depending on how the image was done. But I am not really the “expert” that the thread title request so I could be wrong.

And I don’t think the blending and dithering is an option in Animation Shop so you would have to export all the frames there, send them back to PSP to set the transparancy, then re-assemble them in Animation shop.

Also, bear in mind that anything currently black in the image will become transparent if you set black to transparency. If you need some parts of the image to display as black, there is a color replacer tool you can use to change the background color to something else, then set _that_ color to transparent. But again, it is tricky to work with if the colors are blended at the edges.

---

<div class="post-metadata">

### Author: ![Markxxx](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@Markxxx](https://boards.straightdope.com/u/Markxxx)
#### Post date: [April 10, 2009, 7:22pm UTC](https://boards.straightdope.com/t/web-graphics-experts-possible-to-specify-a-colour-as-the-transparency-in-a-gif/492584/8 "2009-04-10T19:22:04Z")

</div>

XNView is an excellent photo (and it works for gifs) manipulator and it’s free.

You can also go to [gifworks.com](http://gifworks.com/), which is an online image manipulator.

---

<div class="post-metadata">

### Author: ![Lobsang](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lobsang/32/4067_2.png) [@Lobsang](https://boards.straightdope.com/u/Lobsang)
#### Post date: [April 13, 2009, 8:26pm UTC](https://boards.straightdope.com/t/web-graphics-experts-possible-to-specify-a-colour-as-the-transparency-in-a-gif/492584/9 "2009-04-13T20:26:27Z")

</div>

> [@sailor](#):
>
> An animated GIF is composed of a number of individual GIFs. I am guessing you will have to edit the palette of each and every single frame to define the transparent color. . I do not think it can be done globally for all frames but I could be wrong.

I ended up doing it in adobe fireworks (which I have at work). I just set black as the transparent colour and it worked. I didn’t need to do it for each frame.

But it doesn’t look right because there are areas of black that could do with staying black. (I reasoned that it would be shown on dark blue so it wouldn’t be noticeable)

---

<div class="post-metadata">

### Author: ![Reply](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/reply/32/15952_2.png) [@Reply](https://boards.straightdope.com/u/Reply)
#### Post date: [April 13, 2009, 9:06pm UTC](https://boards.straightdope.com/t/web-graphics-experts-possible-to-specify-a-colour-as-the-transparency-in-a-gif/492584/10 "2009-04-13T21:06:14Z")

</div>

> [@Lobsang](#):
>
> I ended up doing it in adobe fireworks (which I have at work). I just set black as the transparent colour and it worked. I didn’t need to do it for each frame.
> 
> But it doesn’t look right because there are areas of black that could do with staying black. (I reasoned that it would be shown on dark blue so it wouldn’t be noticeable)

Fill in the areas that you want to be transparent with another color (flaming fuschia is what we used back in the day) and then choose that to be transparent, not black.
