Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
0
votes
0
answers
27
views
Scripting - Undo Not Working when Editing Image.pixels
I’ve written an operator which edits an image in the Image Editor, but it won't work properly with the undo system. I have created a minimal repro script:
import bpy
img = bpy.data.images['MyImage']
…
1
vote
0
answers
248
views
How to access image depth using python
The channels are acessible through image.pixels, but hot to get the Z-Buffer? …
4
votes
2
answers
2k
views
Create Geometry based on an Image?
for x in range(width):
for y in range(height):
plane = bpy.ops.mesh.primitive_plane_add(size=cubeSize, location=(x*cubeSize, y*cubeSize, 0.0))
index = x + y * width
r = image.pixels … [index]
g = image.pixels[index+1]
b = image.pixels[index+2] …
11
votes
1
answer
2k
views
Procedural volumetric texture generated from a script
If this could be used to set the voxel values on the fly with a custom math function (by setting the image.pixels property, I guess?), then what's left is the colors and changing with the animation. …
1
vote
How to access Render Result pixels from python script?
IMAGES :
image=bpy.data.images['image02'] # image02 as seen in uv editor
imageR=bpy.data.images['Render Result'] # useless, so bad
width=image.size[0]
height=image.size[1]
PIXELS=[0.0 for i in range(len(image.pixels … ))]
# len(image.pixels) == width * height * 3 ( or 4 with the alpha channel )
# here, work with PIXELS
image.pixels=PIXELS …
5
votes
Is it possible to edit images programmatically with the Blender API?
Within blender's image class you can access the raw pixel data at image.pixels as an array of floats, 4 floats per pixel (RGBA). image.size[0] is the width in pixels image.size[1] for height. …
0
votes
0
answers
147
views
Save modified image as a direct copy via scripting API
My current approach is rather ugly:
image.pixels[:] = do_a_flip()
image.update()
image.pack()
image.reload()
image.unpack() …
17
votes
How to measure the dynamic range of an HDRi?
appears to work on EXRs, but your mileage may vary:
import bpy
from math import ceil, log
image = bpy.data.images['your_exr_goes_here.exr']
print("Total dynamic range in stops:")
print( ( log(max(image.pixels … )) / log(2) ) - ( log(min(image.pixels)) / log(2) ) )
# Equivalent to (log(max) - log(min))/log(2) of course. …
0
votes
0
answers
722
views
Float values in image pixel have different precision to set value
)
#FIXED: set data
for i in range(0, WIDTH*HEIGHT*4, 4):
pixels[i] = 0.11111111
pixels[i+1] = 0.22222222
pixels[i+2] = 0.33333333
pixels[i+3] = 0.44444444
image.pixels[:] = pixels
image.update … ()
print(list(image.pixels)) …
2
votes
1
answer
1k
views
Does Blender have a method to a get PNG-formatted bytearray for an image via Python?
pixels = bytearray([int(p * 255) for p in image.pixels])
But, instead of raw pixel data, I would like to get a bytearray containing all the bytes of a PNG-format image. …
2
votes
1
answer
231
views
Passing float texture to fragment shader returns incorrect value in Blender 2.8
bpy.data.images.new(IMAGE_NAME, WIDTH, HEIGHT)
else:
bpy.data.images.new(IMAGE_NAME, WIDTH, HEIGHT)
image = bpy.data.images[IMAGE_NAME]
#FIXED: set data
for i in range(0, WIDTH*HEIGHT*4, 4):
image.pixels … [i] = 0.2
image.pixels[i+1] = 0.3
image.pixels[i+2] = 0.1
image.pixels[i+3] = 0.4
print(list(image.pixels))
# load to gpu
if image.gl_load():
raise Exception()
offscreen = gpu.types.GPUOffScreen …
0
votes
0
answers
574
views
How can I get pixels from multiple render passes through Python and store them to generated ...
This seems to be unnatural and weird way (comparing to something like ...nodes['Render Layers'].output[0].image.pixels) which takes additional memory, processing time and effort. …
9
votes
Is it possible to render vertices in Blender?
num_points = len(points)
image = bpy.data.images.new('ParticleColor', num_points, 1)
# working on a copy of the pixels results in a MASSIVE gain of performance speed
local_pixels = list(image.pixels[:] … + 1] = color[1] / 255.0
local_pixels[column_offset + 2] = color[2] / 255.0
# opacity (0 = transparent, 1 = opaque)
#local_pixels[column_offset + 3] = 1.0 # already set by default
image.pixels …
0
votes
0
answers
63
views
How I can get the pixel data of a render from a script?
bpy.context.scene.render.filepath = render_path + ".png"
bpy.ops.render.render(write_still=True)
image = bpy.data.images.load(bpy.context.scene.render.filepath)
pixels = [int(value * 255) for value in image.pixels …
6
votes
can we send vertex info to voronoi texture node to create texture
imageName in bpy.data.images:
image = bpy.data.images[imageName]
image.generated_width = width
image.generated_height = height
else:
image = bpy.data.images.new(imageName, width, height)
image.pixels …