How to get the truly width and height of frame when rendering? (It would be good if I can render without saving images)
You can get the Python expressions needed by enabling Python Tooltips in the User Preferences, "Interface" tab. Then you can just hover over the resolution settings in the render panel, and see you can use bpy.data.scene["Scene"].render.resolution_x. It's better, though, to use the currently active scene, rather than hard-coding the scene name. Also you'll want to multiply with the resolution scale percentage. This leads you to:

render = bpy.context.scene.render
scale = render.resolution_percentage / 100
rsize_x = render.resolution_x * scale
rsize_y = render.resolution_y * scale