How to scale and resize Subviewport in Godot

Godot Version

Version 4.x

Question

How to change the size of subviewport in godot via code like i dont want it to fully fit the screen i just wanna change its size and when i change its size how can i scale it like i am making a pixelart game with a base res of 640x360 but i dont want it to fully fit the screen i want the main game subviewport to scale to a pixelperfect res and then instead of the black bars there will be a background i made i have done all the things but this change size of subviewport and scaling it i tried so many things but it is not working and there is no documentation about it. Also I can’t use the subviewportcontainer stretch property because that will cause it to resize by itself to any res and not pixelperfect

Calculate and set the size of the container by yourself depending on the main viewport size.

But when I try to set the size of the container or the subviewport itself it just doesn’t change I think it’s cause of the anchors of the subviewportcontainer

Use positional layout mode or calculate anchor points/offsets yourself, don’t use anchoring presets.