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[:]