Page 1 of 1

Saving GIF anims with transparency

Posted: Mon Mar 27, 2017 6:31 pm
by jPV
I can't seem to be able to save GIF anims with the wanted transparent color. Some "random" color gets the transparency always. Actually it seems that the "random" color is the last used color from the palette, or so... at least it seemed like that when I was looking the resulted animation with GIF-Toolkit. The resulting transparent color is always the same no matter what I try to define with the Transparency option.

And second issue, #ATTRTRANSPARENTCOLOR attribute gives always -1 even if I load existing animation with working transparency.

Code: Select all

LoadAnim(1,"Hollywood:Examples/Hollywood/Epiphany/gearsbig.gif")
DisplayAnimFrame(1,0,0,1)
SaveAnim(1,"ram:test.gif", #ANMFMT_GIF, {Transparency=$3432F4}) ; let's try to make the blue gear transparent
FreeAnim(1)
LoadAnim(1,"ram:test.gif", {LoadTransparency=True})
DebugPrint(GetAttribute(#ANIM,1,#ATTRTRANSPARENTCOLOR)) ; this seems to give -1 always
WaitLeftMouse
Cls
DisplayAnimFrame(1,0,0,1) ; some red color gets transparent, last of the used colors in the palette?
WaitLeftMouse

Re: Saving GIF anims with transparency

Posted: Tue Mar 28, 2017 11:50 pm
by airsoftsoftwair
Hmm, true, I'll fix this, thanks for reporting!

Re: Saving GIF anims with transparency

Posted: Thu Apr 27, 2017 9:32 pm
by airsoftsoftwair

Code: Select all

- Fix: When saving a GIF ANIM whose frames didn't have to be quantized because they fit into
  desired number of colors, the transparency pen wasn't set correctly

Re: Saving GIF anims with transparency

Posted: Thu Apr 27, 2017 9:35 pm
by airsoftsoftwair
And second issue, #ATTRTRANSPARENTCOLOR attribute gives always -1 even if I load existing animation with working transparency.
That's normal behaviour. #ATTRTRANSPARENTCOLOR is currently only supported for RGB colors specified when loading an object using the "Transparency" tag. The special "LoadTransparency" tag currently isn't compatible with #ATTRTRANSPARENTCOLOR because in a palette image an RGB color isn't a reliable transparency because it could be in there several times in different pens.