Wayne Fulcher 0 Posted May 29 I am using the latest version of Delphi 12 and I want to simply create a PNG and draw an image on the canvas. However when I try to set the size it always crashes due to bug. My code is simple: png := TPNGImage.Create ; png.SetSize(800, 1100) ; <- Exception occurs here png.Canvas.Draw(.....) ; This code works fine in Delphi 7 so I am trying to understand how to set the size of a TPNGImage instance. Whats happening in Delphi 12 code the SetWidth and the SetHeight just calls Resize() in the background. The problem is when it first calls Resize from the SetWidth, the height has not been set yet so it throws an exception. And if I modify my code to call png.Resize(800, 1100) directly then it throws another exception saying there is no header. What am I missing? TIA Share this post Link to post
Uwe Raabe 2054 Posted May 29 You might have better luck with TPngImage.CreateBlank. Share this post Link to post