[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 1234567[8]910 ]

[ Next Thread | Previous Thread | Next Message | Previous Message ]

Date Posted: 17:33:09 05/08/01 Tue
Author: Michel
Subject: Re: Transparent PNG
In reply to: wto 's message, "Re: Transparent PNG" on 10:40:24 05/08/01 Tue


By using Envision directly, it is not possible to know in advance. If you look at the source code of, EnPngGr.SingleLoadFromStream, it is possible to write a function that will do that by calling the low level function, png_get_bKGD. If the png has a background, it usually means it is transparent.

Best regards,

> But sometime it is impossible to determined whether
>the picture to be loaded is a TPNGGraphic until the
>TPicture.LoadFromFile is called.
>>It not possible to check if the PNG image is
>>transparent. Although, you can specify a background
>>color and it will be used if the png file is
>>For example,
>> Graphic : TPngGraphic;
>> Graphic := TPngGraphic.Create;
>> { put a TPngGraphic in an Image component }
>> Image.Picture.Graphic := Graphic;
>> Graphic.Free;
>> Graphic := Image.Picture.Graphic as TPngGraphic;
>> { force a white background }
>> Graphic.OverwriteFileBackground := True;
>> Graphic.BackgroundColor := MakeRGB(255,255,255);
>> Graphic.LoadFromFile(...);
>>Best regards,
>>>I registered PNG format to TPicture and use
>>>TPicture.LoadFromFile to load the PNG file.
>>>(Because I need to process some other formats, I let
>>>the TPicture to find the proper
>>>TGraphic Class by file extension.) Moreover, I want
>>>know whether the loaded PNG is
>>>transparent and if it is, I want set its background
>>>color to clWhite. What should I do?

[ Next Thread | Previous Thread | Next Message | Previous Message ]


  • Re: Transparent PNG -- Michel, 17:36:27 05/08/01 Tue
    [ Contact Forum Admin ]

    Forum timezone: GMT-5
    VF Version: 3.00b, ConfDB:
    Before posting please read our privacy policy.
    VoyForums(tm) is a Free Service from Voyager Info-Systems.
    Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.