xorpas 4 Posted September 4, 2023 how can create a round picture from bitmap i check this code from chatgpt but not work it save the image as it procedure SaveRoundedImage(SourceImage: TBitmap; SavePath: string); var RoundedImage: TBitmap; RoundedRect: TRectF; begin // Create a new bitmap for the rounded image RoundedImage := TBitmap.Create; try RoundedImage.SetSize(round(SourceImage.Width), round(SourceImage.Height)); // Clear the bitmap (transparent background) RoundedImage.Clear(TAlphaColors.Null); // Create a rounded rectangle RoundedRect := TRectF.Create(0, 0, RoundedImage.Width, RoundedImage.Height); RoundedRect.Inflate(-0, -0); // Draw the rounded image onto the new bitmap RoundedImage.Canvas.BeginScene; try RoundedImage.Canvas.Fill.Color := TAlphaColors.White; // Fill with white background RoundedImage.Canvas.DrawRect(TRectF.Create(10, 10, 200, 270), 30, 60, AllCorners, 100, TCornerType.ctRound); RoundedImage.Canvas.DrawBitmap(SourceImage, TRectF.Create(0, 0, SourceImage.Width, SourceImage.Height), TRectF.Create(0, 0, RoundedImage.Width, RoundedImage.Height), 1.0, True); finally RoundedImage.Canvas.EndScene; end; // Save the rounded image to a file RoundedImage.SaveToFile(SavePath); finally RoundedImage.Free; end; end; Share this post Link to post