Hello,
I try to load a GIF image, and convert it later to a TGA.
The transparency is always lost. The same code works well for PNG files.
Am I doing something wrong, or is there a problem with GIF Transparency?
img := TSingleImage.Create;
img.Format := ifA8R8G8B8;
img.LoadFromFile(FileName);
pourkwapa, loving this library :)
Yes, there was a problem with GIF background color transparency settings.
It is fixed now, new code is in SVN repository.
Also you don't need to set image format before loading (like in your code example).
Whole image (size, format, etc.) is thrown away during loading.
Thanks for the tips. I will check with the svn code.
Hello! Thanks for this great library!
I have a question -- what for is this line in ImagingGIF.pas:
Quote
if HasGlobalPal then
begin
for I := 0 to GlobalPalLength - 1 do
begin
GlobalPal.A := 255;
Read(Handle, @GlobalPal.R, SizeOf(GlobalPal.R));
Read(Handle, @GlobalPal.G, SizeOf(GlobalPal.G));
Read(Handle, @GlobalPal.B, SizeOf(GlobalPal.B));
end;
GlobalPal[Header.BackgroundColorIndex].A := 0;
end;
i.e. line 843: GlobalPal[Header.BackgroundColorIndex].A := 0;
This makes non-transparent GIF images to be shown transparently. It is not correct.
Best regards,
Yury Plashenkov
www.IndaSoftware.com
Looks like a fix for some transparent images that screwed up nontransparent ones.
I changed the code so now it behaves the same as most viewers/editors (for nontransparent GIFs, transparent GIFs with disposal methods defined and those without them).
Updated code is in SVN repository.