How to set dimension of rendered image?

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

obmana
Posts: 1
Joined: Sat Jun 30, 2012 11:41 am

How to set dimension of rendered image?

Postby obmana » Sat Jun 30, 2012 11:46 am

Hi,

I render a scene from Python:

Code: Select all

bpy.ops.render.render()


and get image with dimension 960x540 or similar. How can I set resolution of rendered image to be 640x480 for example, without using GUI?

Thanks

clayh
Posts: 1
Joined: Fri Jul 06, 2012 9:25 pm

Postby clayh » Mon Jul 09, 2012 10:08 pm

Do something like this before rendering the scene:

Code: Select all

# Get the scene
scene = bpy.data.scenes["Scene"]

# Set render resolution
scene.render.resolution_x = 64
scene.render.resolution_y = 32
scene.render.resolution_percentage = 100

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Tue Jul 10, 2012 8:51 pm

replace

Code: Select all

scene = bpy.data.scenes["Scene"]

by

Code: Select all

scene = bpy.context.scene


and it will always take the current scene
I'm sitting, waiting, wishing, building Blender in superstition...


Return to “Python”

Who is online

Users browsing this forum: No registered users and 1 guest