I'm writing an addon and I want to save two sizes of every rendered image. One is the original size which blender saves anyway. The other one is a scaled down version of that image.

How do I scale an image with the Python API (possibly with a specific interpolation filter like linear, cubic, ...)?


2 Answers 2


You can use the Python Image Library (PIL) for instance, there's a Python 3k port:
https://github.com/gpolo/pil-py3k and https://github.com/sloonz/pil-py3k

or Pillow, which is also a PIL fork:

Example code (for original PIL though):

As PIL supported differnt interpolation techniques, all of the above should offer the same (or more).

You could also try without any extra modules, by saving the image in blender to another file using Image.save_render(). Note that this method can be used on any image, it doesn't save the rendered image only (render stands for render settings, the render settings of the given scene will be used to save the file. It ignores the resolution settings however. To change scale, you needed to import the saved image again (so that .pixels isn't empty, which is the case for render results), then call Image.scale() and save again. But you can't specify an interpolation mode.


One could also create a "File Output" node preceeded by a "Scale" node using scripting. This doesn't provide filter options either, though.

Of course this only works with nodes postprocessing turned on.

Blender Wiki Cookbook example


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .