Resizing PNG with alpha channel

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

Moderators: XnTriq, helmut, xnview

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

Resizing PNG with alpha channel

Postby jirik2tg » 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:

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 2464 times
gray.png
gray.png (71.08 KiB) Viewed 2464 times

User avatar
xnview
Author of XnView
Posts: 26999
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Resizing PNG with alpha channel

Postby xnview » Mon Jun 18, 2012 4:30 am

Do you have tried the v3?
Pierre.

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

Re: Resizing PNG with alpha channel

Postby jirik2tg » Mon Jun 25, 2012 5:36 am

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


Return to “GFL SDK”

Who is online

Users browsing this forum: No registered users and 1 guest