Featured post

new redirect for blender.org bpy docs.

http://www.blender.org/api/blender_python_api_current/ As of 10/11 november 2015 we can now link to the current api docs and not be worr...

June 27, 2012

Setting render dimensions equal to loaded image

If you know why this is handy, then i'm glad to help out. I sometimes use background images as references in the 3dview/camera , but if my render resolution + dimensions are not of the same ratio as the x and y of the image being used (as a reference), then the reference becomes squashed. lame.

import bpy

image_index = 0
rnd = bpy.data.scenes[0].render
rnd.resolution_x, rnd.resolution_y = bpy.data.images[image_index].size[:]