Resize rendering image

Hello everyone! I wanted to adjust the size of a rendered image in a Python script, but I couldn’t figure it out. I found the following link, but I couldn’t figure out how to apply it.

https://mcneel-apidocs.herokuapp.com/api/rhinocommon/rhino.render.rendersettings/imagesize

You can use this script:

#! python3

import scriptcontext as sc
import Rhino

rs = sc.doc.RenderSettings
rs.UseViewportSize = False
cursize = rs.ImageSize
cursize.Width = 1920
cursize.Height = 1080
rs.ImageSize = cursize
rs.AntialiasLevel = Rhino.AntialiasLevel.Good

sc.doc.RenderSettings = rs

Before running the script:

After running the script:

It works, thank you very much!