Export figure to bytes and preserve camera settings

Hi,

I’m looking for a way to export figure to image and preserve settings like camera position and zoom.
For now exporting with img_bytes = fig.to_image(format="png") gives the image with default visualization settings.