[Lazarus] How to create a transparent PNG?

Dmitry Boyarintsev skalogryz.lists at gmail.com
Wed Mar 16 20:41:06 CET 2016


On Wed, Mar 16, 2016 at 3:25 PM, Gabor Boros <gaborboros at yahoo.com> wrote:

> I want to draw onto a PNG image and save it without background. Tried
> Transparent, TransparentColor, TransparentMode properties without success.
> I need the A character in the PNG with black color without background. Any
> idea?
>
> procedure PNG;
> var
>   P:TPortableNetworkGraphic;
> begin
>   P:=TPortableNetworkGraphic.Create;
>   P.SetSize(20,20);
>   P.Canvas.TextOut(0,0,'A');
>   P.SaveToFile('TEST.PNG');
>   P.Free;
> end;
>
IIRC this is a bug in PNG component. Try to make at least one pixel
half-transparent.

thanks,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160316/d56088f6/attachment-0003.html>


More information about the Lazarus mailing list