By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,159 Members | 943 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,159 IT Pros & Developers. It's quick & easy.

LIBGIF Problem

P: n/a
Hi there!

does anyone know how to determine with libgif whether the gif has
transparency or not?

ive studied the sources and the internet for hours and found nothing.
theres is just "GifFileType::SBackGroundColor" which seems to be the
transparent color in transparent gifs but i cannot determine whether its
a transparent gif.

need help!

Thank You VERY much!

Marcel
Jun 24 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi!

Well, I don't know the answer to your quetion, but you might have
better luck asking on some libgif forums rather then here. This is
general C++.
adsci wrote:
Hi there!

does anyone know how to determine with libgif whether the gif has
transparency or not?

ive studied the sources and the internet for hours and found nothing.
theres is just "GifFileType::SBackGroundColor" which seems to be the
transparent color in transparent gifs but i cannot determine whether its
a transparent gif.

need help!

Thank You VERY much!

Marcel


Jun 24 '06 #2

P: n/a
i didnt found a better group since they just dont exist or are
spam-only. The Libgif web-forum is not visited very much.

for anyone interested or searching the google-archive in years, heres my
solution (its based on Slurp-Mode and in this example we dont check for
multiple images nor whether an image finally exist):

<code>
bool isTransparent = false;
BYTE transparentcolor = 0;

for(int j=0; j<gifhandle->SavedImages[0].ExtensionBlockCount;j++)
{
switch(gifhandle->SavedImages[0].ExtensionBlocks[j].Function)
{
case GRAPHICS_EXT_FUNC_CODE:
{
if(gifhandle->SavedImages[0].ExtensionBlocks[j].ByteCount==4)
{
if((gifhandle->SavedImages[0].ExtensionBlocks[j].Bytes[0] & 0x01)>0)
{
// YAP! transparency used... get color:
isTransparent = true;
transparentcolor =
(BYTE)gifhandle->SavedImages[0].ExtensionBlocks[j].Bytes[3];
}
}
}
}
}
</code>

Please forgive the bad codeformat, but ascii-email doesnt support that
with its 80 letters-per-line ;)

hf
Marcel
st************@gmail.com schrieb:
Hi!

Well, I don't know the answer to your quetion, but you might have
better luck asking on some libgif forums rather then here. This is
general C++.
adsci wrote:
Hi there!

does anyone know how to determine with libgif whether the gif has
transparency or not?

ive studied the sources and the internet for hours and found nothing.
theres is just "GifFileType::SBackGroundColor" which seems to be the
transparent color in transparent gifs but i cannot determine whether its
a transparent gif.

need help!

Thank You VERY much!

Marcel

Jun 26 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.