[Bf-committers] pixel get & image processing
Sebastian Korczak
admin at myinventions.pl
Tue Apr 27 17:46:19 CEST 2010
I'm sorry for Thunderbird formating error, that's the correct text:
I'm working on 2.5 implementation of old image.getPixelI(x,y) for returning the color
of the (x,y) pixel in the format [r,g,b,a].
getPixelI(x,y) is an instance method in image class (2.49b).
Maybe I'm wrong, but Blender 2.5 haven't methods like this we can access from python code.
So, first I made get pixel property in bpy.types.image:
bpy.data.images['image_name'].pixels
- property have access to ImBbuf but can't take any arguments like pixels(x,y).
- image properties are in \source\blender\makesrna\intern\rna_image.c
Then I made getpixel operator in bpy.ops.image:
bpy.ops.image.pixel(image='im', x=1, y=1)
- it takes arguments but there are problems:
- how to access image with it's name only (context.space is text_editor) or
with it's struct from bpy.data.images['image_name'] or
with it's pointer from bpy.data.images['image_name'].as_pointer()
- how to return rgba values
- image operators are in source\blender\editors\space_image\image_ops.c
Any ideas?
What do you think about start Blender Image Processing module with operators like this:
bip.getPixel(image=im, x=1, y=1)
bip.filter(image=im, filter='greyscale')
bip.threshold(image=im, R=128, G=128, B=128, A=255)
More information about the Bf-committers
mailing list