|
![](/i/fill.gif) |
OpalPlanet wrote:
> Is there any way to take the color of a certain area of an image (jpeg, png,
> etc.) and find out its values in rgb?
As an alternative to Warp's suggestion, you may want to try using
eval_pigment. It doesn't require you to make the pigment into a function
beforehand, but you must still pre-declare it. Here's an example:
#include "functions.inc" // Required. Include this or transforms.inc
#declare img= // our image to test
pigment{
image_map{
//sys"fish.bmp"
tga"gold_nugget.tga"
}
translate -(x+y)/2 // center the image
scale<1.33,1,1>*10 // scale the centered image
}
#declare test_color=
eval_pigment(
img, // the pigment we are testing
<0,0,0> // The point in 3d space to test at.
// It will test AFTER the above transformations
);
sphere{0,.5 // a sphere to show tested color
pigment{
test_color // this is legal
//rgb test_color // so is this
//rgb <test_color.x, test_color.y, test_color.z> // this also works
}
finish{ambient 1}
}
plane{z,.5 // plane to show entire pigment
pigment{img}
finish{ambient 1}
}
I hope this is helpful~
~Sam
Post a reply to this message
|
![](/i/fill.gif) |