Is texture pixel color accessible from within ruby?
-
is there a known implementation of sampling color from a specific pixel of a texture? (not the material or its ID but the specific RGB) or are there any possible workarounds that come to your mind? thanks
-
Not unless you want to tie into ImageMagick (and require all users to install it to make the script work), or learn about how to extract pixel data manually from image files.
Sorry...
-
How about turning your model into "just" shaded (with colours) mode (instead of "with textures")? SU then gives an approximation of the average colour of that particular texture which you can then sample.
Or have I completely misznderstood what you want?
-
Thanks 4 your replies guys, your tips are very useful, my problem is in not mentioning the purpose...
the purpose was to have bitmap-analysis capabilities in sketchup, like displacement mapping and such. that would require to assign values to a grid by the specific color of the underlying texture. the possible workflow involves like rick suggested - using a 3rd party software to analyse the image and possibly convert it to an array (grid) of values (with customizable resolution). the method suggested by gaieus is interesting but not applicable since a subdivided texture maintains the same material 'parent' and therefore the bitmap approximation stays the same for each region, if i'm not mistaken.
i'll probably look into scripting imagemagick to convert images into a organized data - and writing an importer into SU. any suggestions?
-
If a possible application would be contour maps generated from grayscale images, then it's been done. Check the SketchUp Pro user group boards, and look at some OLD ruby stuff. I can't remember the names of things, but TBD had one, and maybe Dider had something.
Advertisement