Vampyre Imaging Library Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Imaging 0.26.4 Released!

Author Topic: GIF Transparency  (Read 1248 times)

pourkwapa

  • Imaging User
  • *
  • Offline Offline
  • Posts: 2
    • View Profile
GIF Transparency
« on: 2 December 2007, 17:15:44 »

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?

Code: [Select]
  img := TSingleImage.Create;
  img.Format := ifA8R8G8B8;
  img.LoadFromFile(FileName);

pourkwapa, loving this library :)
Logged

Galfar

  • Administrator
  • Imaging User
  • *****
  • Offline Offline
  • Posts: 249
    • ICQ Messenger - 327174200
    • View Profile
    • Galfar's Homepage
    • Email
Re: GIF Transparency
« Reply #1 on: 3 December 2007, 00:29:18 »

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.
Logged

pourkwapa

  • Imaging User
  • *
  • Offline Offline
  • Posts: 2
    • View Profile
Re: GIF Transparency
« Reply #2 on: 3 December 2007, 11:27:59 »

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

Yurik

  • Guest
Re: GIF Transparency
« Reply #3 on: 12 April 2008, 05:53:06 »

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
Logged

Galfar

  • Administrator
  • Imaging User
  • *****
  • Offline Offline
  • Posts: 249
    • ICQ Messenger - 327174200
    • View Profile
    • Galfar's Homepage
    • Email
Re: GIF Transparency
« Reply #4 on: 14 April 2008, 01:20:45 »

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.
Logged
 

Page created in 0.064 seconds with 18 queries.