Incorrect painting on png image loaded from file lazarus / 39-Graphics ---------------------------------------------------------------------- wp · 2012-12-20 15:04 Suppose I want to paint a red rectangle onto the canvas of a png graphic. The graphic is loaded from the attached file. But the image into which the modified png is copied shows only a punched-out rectangle. I tried various different approaches, but don't find the clue. The issue seems to be related to this particular file. When I am using png files that I saved from screenshots the program has normal behaviour..  I am using the following code to load and modify the png file and to show it in a TImage component: Code: [Select]procedure TForm1.FormCreate(Sender: TObject); var   png: TPortableNetworkGraphic; begin   png := TPortableNetworkGraphic.Create;   try     png.LoadFromFile('test.png');     png.Canvas.Brush.Style := bsSolid;     png.Canvas.Brush.Color := clRed;     png.Canvas.Rectangle(100, 100, 200, 200);     Image1.Picture.Assign(png);   finally     png.Free;   end; end;       What is wrong?