Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-03

How to create a transparent PNG?

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Gabor Boros

Hi All,

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;

Gabor

Reply by email

Dmitry Boyarintsev
to Gabor Boros
Gabor Boros wrote 16 lines
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.freepascal.org/pipermail/lazarus/attachments/20160316/d56088f6/attachment.html>

Reply by email

Vojtěch Čihák
to Gabor Boros: I want to draw onto a PNG image and save it without background. Tried Transparent,…

Hi,
?
there also must be
?
P.Canvas.Brush.Style:=bsClear;
?
before drawing text.
?
V.
______________________________________________________________

Show quoted text 5 lines
Od: Gabor Boros Komu: Datum: 16.03.2016 20:27 P?edm?t: [Lazarus] How to create a transparent PNG?

Hi All,

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;

Gabor

Reply by email