PNG transparency problem - bug? (example) [GFLAx/ASP]

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

Moderators: XnTriq, helmut, xnview

mindplay
Posts: 16
Joined: Wed Sep 21, 2005 9:30 am
Location: Denmark

PNG transparency problem - bug? (example) [GFLAx/ASP]

Post by mindplay »

My goal is to generate and save a semi-transparent PNG.

Here's my code:

Code: Select all

<%

Const AX_PNG = 3

Set Pic = Server.CreateObject("GflAx.GflAx")

Pic.UseTransparency = True
Pic.LoadBitmap Server.MapPath("_trans.png")

Pic.FontName = "Verdana"
Pic.FontSize = 36

Pic.TextOut "This is a test", 0, 0, RGB(255,0,0)

Pic.SaveFormat = AX_PNG
Pic.SaveBitmap Server.MapPath("test.png")

Set Pic = Nothing

%>
<HTML><HEAD></HEAD><BODY>test.png saved...</BODY></HTML>
It should be pretty straightforward ... create a blank image, set some text on it, save it.

But first of all, creating a blank (transparent) image does not seem to be possible in the first place. I assumed the following would work:

Code: Select all

Set Pic = Server.CreateObject("GflAx.GflAx")
Pic.UseTransparency = True
Pic.NewBitmap 300, 200, &HFFFFFFFF
Where "&HFFFFFFFF" should mean fully transparent white. But the script won't run at all, just gives an "overflow" error at that line.

So I ended up loading a semi-transparent PNG instead, as in the example above ... this at least runs, but doesn't produce any useful result. For some reason, in the example above, the image produced has it's transparency mask inverted ... when I open the output file in Photoshop, everything is purple, the text which I set in red comes out transparent, and the rest of the transparency mask seems to have been completely mangled...

download a zipped copy of the code and images here...

Open the two images in photoshop to see the difference ... (my script does not output an IMG tag, because semitransparent PNG is not supported in Internet Explorer).
User avatar
xnview
Author of XnView
Posts: 44920
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: PNG transparency problem - bug? (example) [GFLAx/ASP]

Post by xnview »

mindplay wrote:Open the two images in photoshop to see the difference ... (my script does not output an IMG tag, because semitransparent PNG is not supported in Internet Explorer).
Ok, it's a bug.... I'll fix it
Pierre.