I'll explain the numbering of what I did.

  1. I created a text file called lowRes inside the blend file as shown in the attached image.
    enter image description here
  2. And I noticed that when I click Run Script in Blender run with GUI, the resolution of all scenes is changed to 128x72.
  3. Then undo by pressing Ctrl + Z, set it to 1920x1080 resolution, and save the file.
  4. And I did the Command Line Rendering using the code below.
blender -b "my.blend" ^
-P lowRes.py ^
-S "scene 01" ^
-o "//output\##" -F PNG -f 3 ^
-S "scene 02" ^
-o "//output\##" -F PNG -f 5

03.png and 05.png were generated as expected.
But the resolution is 1920x1080, not 128x72.
The python code doesn't seem to be running.
What am I doing wrong?

  • 1
    $\begingroup$ FWIW This works as expected for me. The -P is for an external python script. If so: make sure your script is saved in same folder as CLI. Passing a wrong name for script it fails silently and renders images with default size. If the script is a text block in blend then blender -b --python-text "lowRes" $\endgroup$ – batFINGER Feb 10 '20 at 13:11
  • $\begingroup$ @batFINGER amazing! That works for me! --python-text was listed in the official manual but I haven't looked into it closely. I have one last thing I want to know. As far as I know, if you don't have a textblock or external python file, you can run python code with --python-expr. But I failed to execute lowRes code using --python-expr. I am using Notepad. How can I write code that works correctly? $\endgroup$ – J. SungHoon Feb 10 '20 at 13:35
  • 1
    $\begingroup$ An example of using expression blender -b --python-expr "import bpy; print(bpy.data.scenes[:])" Personally wouldn't do it. Would use the external script. (Save from notepad with a .py extension) $\endgroup$ – batFINGER Feb 10 '20 at 13:42
  • $\begingroup$ @batFINGER Am I misunderstanding expression? I expected to include the code for scene.render.resolution_x and scene.render.resolution_y after --python-expr. However, from the example you wrote, it seems that --python-expr doesn't work alone. $\endgroup$ – J. SungHoon Feb 10 '20 at 13:48
  • 1
    $\begingroup$ Not sure what you mean by working alone? Have to somehow put the whole script into a single line expression. Again: I Wouldn't use that option. $\endgroup$ – batFINGER Feb 10 '20 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.