ScreenShot is toooo small when red/yellow/green view too small

I resize main window like this .

and I use captureImageFromView function to generate screenshot, the screenshot like this

small_screenshott

What can I do to make the size of the screenshot independent of the display window?

You need to make your main window bigger or undock all the widgets (module panel, Python interactor, etc.) that take up space in your main window. You can also maximize each view and take screenshot one by one, change the main window size to be larger than your screen size (slicer.util.mainWindow().size=qt.QSize(2000,2000)), or create a slice viewer outside the main window and set its size to be very large.

What if the screen is very small?

You can adjust your screen resolution in your system settings and/or adjust the application scaling using environment variables.