Mobile app version of vmapp.org
Login or Join
Pope1402555

: Changing "color" of transparency layer in GIF I have some GIF files that are not observing transparency when I load them in .NET, via System.Drawing.Image.FromFile(). However, I have a some others

@Pope1402555

Posted in: #Gif #Transparency

I have some GIF files that are not observing transparency when I load them in .NET, via System.Drawing.Image.FromFile().

However, I have a some others that do.

When I have a look at the color palette, the ones that do work have argb(0,255,255,255) and the ones that don't work have argb(0,0,0,0).

Is it possible to change the color of this layer in the images that don't work to be argb(0,255,255,255)? I'm hoping this is going to solve my problem when loading in .NET.



Update: After 5 hours trying to work out why these particular images were not working for transparency, in my application, when others did, I eventually delivered the code and images to the test environment. And in that environment, they happened to work. Same code, same images. My conclusion is that there must be a runtime difference that prevents the transparency from working, perhaps a difference in .NET versions.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Pope1402555

1 Comments

Sorted by latest first Latest Oldest Best

 

@BetL875

Using the freeware tool Irfanview we can save any GIF file with a newly defined transparency color.

To do so open the GIF file with Irfanview to select "Save as..". Choose GIF as output format. The following dialog will open:



We now have the choice to give in a color number we wish to have transparent, or choose the transparent color before we save. The latter will open a preview window where we can select the desired transparent color with the mouse.

Alternatively we can also conver the transparency of a GIF file using convert from ImageMagick. Below example will make "black" transparent:

convert orig.gif -transparent black transp.gif


For further options, and how to identify the colors of a GIF see:


How do I set a color to be transparent...
ImageMagick documnetation on GIF formats

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme