• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

GIF Transparency

Started by pourkwapa, 2 December 2007, 17:15:44

Previous topic - Next topic

pourkwapa

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 :)

Galfar

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.

pourkwapa

Thanks for the tips. I will check with the svn code.

Yurik

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

Galfar

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.

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Name:
Email:

Shortcuts: ALT+S save/post or ALT+P preview

SMF spam blocked by CleanTalk