Is there a fix planned for transparency loaded from PNG/GIF?

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, xnview

jgrundy
Posts: 3
Joined: Wed Jul 23, 2008 3:40 pm

Is there a fix planned for transparency loaded from PNG/GIF?

Post by jgrundy »

When I use LoadBitmap to open a GIF or PNG, transparency info is lost and I can't find any way of retrieving it.

Is there any plan to address this? What sort of time frame?

Perfect happiness:
Alpha transparency remembered when loading from a full colour PNG. Pixel transparency remembered when loading from a colour-indexed file with transparency. (Might as well load "pixel" transparency simply as fully alpha transparent.)

Mostly happy:
Alpha transparency not catered for, but pixel transparency remembered from colour-indexed file.

In either case, the ability to render / overlay the loaded image over either another image or a specificed background colour (such that the background shows "through" appropriately) would be really useful.

If this is already possible in gflax 2.82 I'm not seeing it. All I get is the "colour" of the transparent pixel... I don't see any way of figuring out if that was actually supposed to be transparent or opaque, and no way of separating the "colour" of the transparent index a colour-indexed file from a matching opaque colour. eg if "transparent" is black plus another colour index is opaque black, I can't tell (a) what the transparent colour was at all or (b) which "black" pixels were / were not supposed to be transparent.
User avatar
xnview
Author of XnView
Posts: 36291
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Is there a fix planned for transparency loaded from PNG/

Post by xnview »

I don't understand, you have TranpsrentIndex for 8bits, and alpha channel for 32bits
Pierre.
jgrundy
Posts: 3
Joined: Wed Jul 23, 2008 3:40 pm

Post by jgrundy »

Then maybe I don't understand the library, or have the wrong thing.

I'm using GflAx.dll v2.82.0.0, dated 27/Feb/2008. (Light.)

The only class I can see published from this library is "GflAx".

This does not make public a "TransparentIndex" property, nor can I see anything which tells me what color index a pixel is. I have only a GetColorAt(x,y) method, which returns the translated color from an indexed image.

Suppose I have a PNG file with large regions 100% transparent

If I say...
oImg.LoadBitmap <png>
and examine oImg.GetColorAt(0,0) (which is transparent) I get FFFFFF


What I want to do is load a PNG file, make decisions about which pixels to make transparent based on the level of transparency in the original image, reduce the colour depth, and save a GIF.


If I say...
oImg.LoadBitmap <png>
oImg.BackColor = <808080>
oImg.MaskColor = <808080>
oImg.ChangeColorDepth 64
oImg.SaveFormat = AX_GIF
oImg.SaveBitmap <gif>

The resulting GIF file has no transparent pixels, and the colour used for each pixel is approximately the residual colour from the original PNG pixel.


I do note that if I say...
oImg.LoadBitmap <png>
oImg.SaveBitmap <new>
... then transparency info is preserved.


But I can't detect or manipulate any information about transparency through the gflax object. What have I missed?

Related... I in any way overlay one image with another, including transparency?
User avatar
xnview
Author of XnView
Posts: 36291
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Post by xnview »

jgrundy wrote:Then maybe I don't understand the library, or have the wrong thing.
Oh ok, right GflAx has some problem
Pierre.
jgrundy
Posts: 3
Joined: Wed Jul 23, 2008 3:40 pm

Post by jgrundy »

Ok so I guess you're talking about something that isn't gflax then?

What tool/s or library am I supposed to load so I can manipulate images with transparency from code? On Windows, does it require a full installation of some sort, or can I simply register the right library file/s?