<PackageReference Include="System.Drawing.Common" Version="9.0.0-rc.1.24451.1" />

CachedBitmap

public sealed class CachedBitmap : IDisposable
Represents a device-dependent copy of a Bitmap matching a specified Graphics object's current device (display) settings. Avoids reformatting step when rendering, which can significantly improve performance.
public CachedBitmap(Bitmap bitmap, Graphics graphics)

Creates a device-dependent copy of bitmap for the device settings of graphics.

public void Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.