Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 772 Bytes

Image_Pixels.md

File metadata and controls

34 lines (25 loc) · 772 Bytes

Blender comes with numpy built in. yep!

Mix 3 images

import math
import numpy as np
import bpy

def np_array_from_image(img_name):
    img = bpy.data.images[img_name]
    return np.array(img.pixels[:])

pixelsA = np_array_from_image('A')
pixelsB = np_array_from_image('B')
pixelsC = np_array_from_image('C')
pixelsD = (pixelsA + pixelsB + pixelsC) / 3

image_D = bpy.data.images['D']
image_D.pixels = pixelsD.tolist()

# then click in the UV editor / to update the view..to see the pixels of `D` updated

imge

Add smallest of each array

# add smallest element values
interim_1 = np.minimum(pixelsA, pixelsB)
pixelsD = np.minimum(interim_1, pixelsC)

img2