Resizing PNG with alpha channel
Posted: Mon Jun 18, 2012 12:00 am
Hi,
This was already discussed here however without any result. Is resizing of PNG image with alpha channel supported? When I try to do it with GFLAx (ActiveX/ASP component) light v2.80, I just get a black background in the resized image.
This is the code I am using:
Note that uncommenting the commented code does not help. I am attaching a sample picture with that behavior and the resized result.
Thanks for any ideas.
Jiri
This was already discussed here however without any result. Is resizing of PNG image with alpha channel supported? When I try to do it with GFLAx (ActiveX/ASP component) light v2.80, I just get a black background in the resized image.
This is the code I am using:
Code: Select all
Function ResizeImage(Path, NewPath, NewMaxDimension)
Set ctrl = Server.CreateObject(ImageComponent)
With ctrl
.EnableLZW = true
.LoadBitmap Path
If .Width > .Height Then
NewWidth = NewMaxDimension
NewHeight = .Height/.Width * NewMaxDimension
Else
NewHeight = NewMaxDimension
NewWidth = .Width/.Height * NewMaxDimension
End If
If NewWidth < .Width Then
.Resize NewWidth, NewHeight
End If
' .UseTransparency = true
' .SaveFormat = 3 'AX_PNG
.SaveBitmap NewPath
End With
Set ctrl = nothing
End Function
Thanks for any ideas.
Jiri