i have a GUI made in pyside that render a blender file. This GUI have a resolution options to control this before render scene.... i have this code in PyCharm, i need to run this code without open blender.
if resolutionWidth != 0:
bpy.context.scene.render.resolution_x = resolutionWidth
if resolutionHeight != 0:
bpy.context.scene.render.resolution_y = resolutionHeight
# Override Resolution Scale
#SCALE = batchRender_UI.resolution_scaleUI()
if SCALE != 0:
bpy.context.scene.render.resolution_percentage = SCALE
You can run a blender's python script without opening blender's GUI in background from command line. Go to directory where blender is installed, open terminal/cmd over there and type following command -
blender -b -P path/to/your/script.py
The flag -b tells blender to run in background. -P tells to run a python script using blender's python. If you want to open blender's GUI and run py script then run the following code:
While running as subprocess use the following code: