2
$\begingroup$

How to 'scale/resize' images in the material nodes?

For example, I have an image texture of resolution 4000-by-4000. Now, that texture takes up a lot of memory during rendering, so I want it of the size 2000-by-2000. This is possible by using an external image editor like Photoshop, but what should be done to control this scaling in the material nodes itself?

Thank you.

$\endgroup$
4
$\begingroup$

In short: There is no node for this within the material editor

The node system is for JIT operations, and if you want to rescale an image, you probably don’t want to do it everytime you run the nodetree.

But there are work arounds

Blender let’s you change the image instance resolution (instance here means that without saving it to a new file, the rescaled image will be lost when you close the session). But as far as I can tell you have to use the python script panel.

You'd probably have to use something like the blenderpy code below:

import blenderpy as bpy

width = 2000
height = 2000
bpy.data.images['Directory to Your Image'].scale(width, height)

Or there is a method with pillow:

from PIL import Image

basewidth = 300
img = Image.open('fullsized_image.jpg')
wpercent = (basewidth / float(img.size[0]))
hsize = int((float(img.size[1]) * float(wpercent)))
img = img.resize((basewidth, hsize), Image.ANTIALIAS)
img.save('resized_image.jpg')

Alternatively blender does have an image editor that can adjust resolution and output a new file with the resolution for you to open in the node editor, but I think this option is a little redundant. You may as well resize the image in a purpose built image editor.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.