What's new

Turn a background transparent on an animated gif


fredfish

Guru
Messages
887
Likes
1,247
Hi all

is there an easy way to turn the background transparent on an animated gif?

I have a student that is creating an animated game "Ident" using Photoshop and he wants to add an animated gif. The gif is a series of flames against a black background.

My initial thought was to group all the layers and then change the blend mode to screen - but that didn't work. I then tried changing the blend mode for each of the layers (well some of the to begin with as there are 120 frames in the animation - that also didn't work.

I am thinking there must be an easy way of doing this and that I am missing something simple!

TIA

John
 
Last edited:

MrToM

Guru
Messages
3,504
Likes
3,226
Personally I'd need more detailed info before even beginning to think about making any suggestions.

...on an animated gif?..
Is this an existing 'gif' file or do you have the layered file that created it?
Failing that, do you have the images that could be used in a layered file so that a 'gif' animation could be created from it?


...he wants to add an animated gif...
To what? You could use a matte but that depends entirely on how the file is used, where, when, etc etc


...My initial thought was to group all the layers and then change the blend mode to screen..
So does this answer my first question....you DO have an original layered file that could be used to create an animated 'gif' ?


...I am thinking there must be an easy way of doing this...
There is...don't use an Adobe product. :rofl:


There could, and I stress the word could, be an easier way. Unfortunately, more often than not, people assume they can just edit a 'gif' file as it is just a series of still images....while this is true those images are in fact flattened versions of the original layers of a layered file making them far more difficult to edit.

If you have a PSD, or other layered file format, file of the original images that created the 'gif' then yes, it could be easier....but even then its no guarantee....it still depends on each layer as to how easy it is to edit.

Editing the final 'gif' file is always going to be more complex and time consuming as you only have the 'flattened' frames to work with, not the actual layers that created them.

If you can share the media you have it may help in finding a solution.

Regards.
MrToM.
 

fredfish

Guru
Messages
887
Likes
1,247
I am working with this student again tomorrow and will ask him if he minds me sharing his files.

So far he has created an animation that consists of a few elements that comprise a wall background, a large shield on the wall (this has a lighting effect animated around the shield) some wispy smoke and some dust elements floating across the screen.

What he wants to add is a fire at the bottom part of the screen.

My thought was to find an animated .gif - which we found (unfortunately I cant link you to it as I am not at the college at the moment) - Then copy each of the frames from the layered gif into the sequential layers of his existing animation. The final animation is NOT going to be exported as a .gif. But the .gif that we have has a black background and because it is 120 + layers I didn't want to edit each layer individually. This is the reason why I wanted to see if there is an easy way (for easy read quick) to remove the background of the .gif in one hit.

I did find an online converter that says it can remove solid colour backgrounds from .gis - I haven't had the chance to try it yet - but that backs up your statement of not using Adobe products :cheesygrin:.

To be honest he would have been significantly better off doing this bit in After Effects which would only be a 5 minute job - but he is insistent that he wants to try and do everything within Photoshop.

I think this is a case of the wrong tool for the job - but that is what he wants.

Cheers

John
 

thebestcpu

Guru
Messages
1,652
Likes
1,482
I agree with Mr Tom about sharing the GIF as much better recommendations could be given. There are a variety of GIF options that may limit the tricks that would work in Photoshop.

However, if this is a GIF where each Layer is a simple black background and the each animation frame is a single Layer then the following option "may" help out.

1) Make sure that the lowest Layer in the stack is not a Background Layer (if it is just turn it into a regular Layer)
2) Turn off visibility of all Layers yet one (Opt/Alt click on eyeball for that Layer). In Layer Styles, slide the Blend If slider for you existing Layer from the left side over to the right until just the amount of flame you want is showing (the rest will be transparent)
3) Once this works for one Layer, you can copy and paste that Layer Style to all other Layers and then only the flame will show and the rest will be transparent around the flame.

The above works if each frame is with the visibility turned on for only one Layer for each animation frame.

So the above is a lot of ifs yet thought it was worth mentioning

John Wheeler
 

MrToM

Guru
Messages
3,504
Likes
3,226
Hmmmm...right.

Using an existing 'gif' is always going to be a PITA, just as any 'flattened' image is to edit....and in this case harder still by a factor of 120!

Being an existing 'gif' file with frames, (not layers), and from your description, it may be best to just re-create the 'gif' from the frames extracted from the original 'gif' file, (It will be exactly the same as the original gif animation), but map in some transparency before committing to saving.

This may be better than adding a matte colour as you can select more than one colour for it to apply to.

Try that and see if it gets you closer....it may not be perfect, (I doubt it ever could be), but it may just be enough.
Trying it in-situ will be the only way to really see if it works.

Its the quickest method I can think of.

Regards.
MrToM.
 

MrToM

Guru
Messages
3,504
Likes
3,226
...you can copy and paste that Layer Style to all other Layers and then only the flame will show and the rest will be transparent around the flame...
Nice solution John.

You could save some time by putting all the layers in a 'group' FIRST and then setting the 'Blend If' to the GROUP....this will then do ALL the layers at once...

GIF_Transparency_MT_01.png

Just a thought.

Regards.
MrToM.
 

thebestcpu

Guru
Messages
1,652
Likes
1,482
Nice solution John.

You could save some time by putting all the layers in a 'group' FIRST and then setting the 'Blend If' to the GROUP....this will then do ALL the layers at once...



Just a thought.

Regards.
MrToM.
Even better!

John Wheeler
 

fredfish

Guru
Messages
887
Likes
1,247
These are all really great suggestions - thanks for the help.

When I am with him again tomorrow I will give them a try and report back.

Thanks again guys.

Cheers

John
 

MrToM

Guru
Messages
3,504
Likes
3,226
No worries.

Just a small addition to 'grouping' the layers and using the 'Blend If' method....select ALL the FRAMES and ALL the LAYERS before grouping. I didn't get this in my screen shot, sorry.

If you don't have ALL the FRAMES selected you'll find that all but those selected will become transparent when grouped.

Also make sure that the 'Dispose Method' is set to 'Automatic' for all frames.

Regards.
MrToM.
 

fredfish

Guru
Messages
887
Likes
1,247
OK just reporting back.

I went through the options with the student and he has decided not to include the fire effect in his animation.

It is looking pretty good (IMHO) - once he has finished it I am going to post it for him in the gallery section.

Just for personal learning I think I am going to try this myself anyway!

Cheers

John
 

Top