|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi all -
It's been a few days since my last random question, so here we go -
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? Someting along the lines of the
"eyedropper" tool in Photoshop for defining custom colors?
Thanks
OpalPlanet
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
OpalPlanet <ecs### [at] msncom> 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?
Perhaps a bit surprisingly, there is:
// The image will extend from <0, 0, 0> to <1, 1, 0>:
#declare Image = function { pigment { image_map { jpeg "SomeImage" } } };
#declare Pixel = Image(.5, .5, 0);
#debug concat("The value at <.5, .5> is <", vstr(3, Pixel, ", ", 0, 3), ">\n")
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
That's awesome, thanks Warp!
-OpPl
Warp <war### [at] tagpovrayorg> wrote:
> OpalPlanet <ecs### [at] msncom> 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?
>
> Perhaps a bit surprisingly, there is:
>
> // The image will extend from <0, 0, 0> to <1, 1, 0>:
> #declare Image = function { pigment { image_map { jpeg "SomeImage" } } };
>
> #declare Pixel = Image(.5, .5, 0);
>
> #debug concat("The value at <.5, .5> is <", vstr(3, Pixel, ", ", 0, 3), ">n")
>
> --
> - Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Samuel Benge <stb### [at] thishotmailcom> wrote:
> As an alternative to Warp's suggestion, you may want to try using
> eval_pigment.
Internally eval_pigment does exactly what my example, but it does it
every time you call it, and thus it's much slower. If you define a
pigment function yourself you only have to do it once and call the
same function repeatedly, which is much faster.
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
> Samuel Benge <stb### [at] thishotmailcom> wrote:
>> As an alternative to Warp's suggestion, you may want to try using
>> eval_pigment.
>
> Internally eval_pigment does exactly what my example, but it does it
> every time you call it, and thus it's much slower. If you define a
> pigment function yourself you only have to do it once and call the
> same function repeatedly, which is much faster.
Again, you teach me something I did not know. I have a certain file
which is badly in need of this information. Thanks!
Now, to the docs! To see if I have no excuse for my ignorance :)
~Sam
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Wow, that is cool. I was mass-measuring some images with povray for a work
application and went to the trouble in my first case of converting each one
to ASCII-format PPM's.
Warp wrote:
> OpalPlanet <ecs### [at] msncom> 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?
>
> Perhaps a bit surprisingly, there is:
>
> // The image will extend from <0, 0, 0> to <1, 1, 0>:
> #declare Image = function { pigment { image_map { jpeg "SomeImage" } } };
>
> #declare Pixel = Image(.5, .5, 0);
>
> #debug concat("The value at <.5, .5> is <", vstr(3, Pixel, ", ", 0, 3),
> #">\n")
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|