Isotropix Forums

Render animation using python

Clarisse Scripting related topics

Render animation using python

Unread postby fmogollon » Thu Oct 11, 2018 3:39 pm

Hi,

I am new to clarisse and I am trying to learn using it by using python.

I would like to know if there is such way to make a render of an scene by command line using python scripting or ix helpers.

I have correctly set up keys for intermediate movement of my figure but I cannot find how to render the scene and save it in jpeg formats using only python.

I can do it by clicking on the render button from render manager, but I cannot guess to do it by command line.

Any ideas?

Thanks in advance.

Felipe
fmogollon
 
Posts: 1
Joined: Thu Oct 11, 2018 3:34 pm

Re: Render animation using python

Unread postby bvaldes » Fri Oct 12, 2018 8:58 am

Hello,

To render an image in python you have to compute the image first and then choose in which format you want to save it. If you want to render a sequence you have to change the current frame by script and then compute again the image.
Take a look to this example:

python code

image = ix.get_item("project://scene/image") # This is our image

# Let's say that you want to render the 10 first frames
for i in range(10):
ix.cmds.SetCurrentFrame(i) # You set the current frame to the value of i (i is a number between 0-9 incremented at each iteration of the loop)
# Then you compute the image. The image is computed to the current frame that's why you have to change the current frame each time.
computedImg = ix.render_image(ix.get_item("project://scene/image"))
# The you save your image. Here it's in jpg, if you want a exr you can use ix.save_exr16 (for 16bit) or ix.save_exr32 (for 32bit).
# The command take 2 arguments:
# 1 - The image computed
# 2 - The path to save you image. Be carefull the path have to take care of the frame number else, the image will be overwrited each frame.
ix.save_jpg(computedImg, "C:/Users/bvaldes/Desktop/renders/plop_"+str(i))

I hope this help, if you need more information, feel free to ask

Regards
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 286
Joined: Mon Sep 26, 2016 10:44 am


Return to Scripting
cron