Resizing PNG with alpha channel

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

Moderators: XnTriq, helmut, xnview

Post Reply
jirik2tg
Posts: 2
Joined: Sun Jun 17, 2012 11:52 pm

Resizing PNG with alpha channel

Post by jirik2tg »

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:

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
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
Attachments
gray_resized.png
gray_resized.png (31.99 KiB) Viewed 3077 times
gray.png
gray.png (71.08 KiB) Viewed 3077 times
User avatar
xnview
Author of XnView
Posts: 43327
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Resizing PNG with alpha channel

Post by xnview »

Do you have tried the v3?
Pierre.
jirik2tg
Posts: 2
Joined: Sun Jun 17, 2012 11:52 pm

Re: Resizing PNG with alpha channel

Post by jirik2tg »

xnview wrote:Do you have tried the v3?
Ok, v3 solves the problem.

Just btw, is there a x64 binary of gflax included? I couldn't find it, so I had to recompile.

Thanks for the help.

Jiri
Post Reply