How to get a pixel value from an image file?
-
Is there a relatively simple way to do this? It does not seem possible with the SketchUp API or with the core Ruby methods. I suppose there are many methods using external DLLs but I am looking for something as easy as possible. I think it might be possible by using a WebDialog in combination with the HTML5 <canvas> element and some javascript, but I don't think the <canvas> element will work on Windows systems using a Webdialog.
What I am after is getting the RGB values of a texture for a given pair of UV coordinates.
Thanks.
-
I'm interested in this too. The only script I can think of right now is one that Didier Bur made to make displacement from a greyscale map. Maybe you can find something there?
-
@whaat said:
Is there a relatively simple way to do this? It does not seem possible with the SketchUp API or with the core Ruby methods. I suppose there are many methods using external DLLs but I am looking for something as easy as possible. I think it might be possible by using a WebDialog in combination with the HTML5 <canvas> element and some javascript, but I don't think the <canvas> element will work on Windows systems using a Webdialog.
What I am after is getting the RGB values of a texture for a given pair of UV coordinates.
Thanks.
Or maybe you can find some ruby libraries that allows you to read directly from the files.
-
@thomthom said:
Or maybe you can find some ruby libraries that allows you to read directly from the files.
I've looked around a bit. You would think there would be one but I think everyone Ruby library I have found is just a bridge to another library that was done in C++. (Maybe that's the only way it can be done...)Are you there Didier? I am sure you have some ideas.

-
@pixero said:
I'm interested in this too. The only script I can think of right now is one that Didier Bur made to make displacement from a greyscale map. Maybe you can find something there?
Do you have the link?
-
I think it's the heightfield generator: http://www.crai.archi.fr/RubyLibraryDepot/Ruby/em_fil_page.htm
Scrambled plugins. But they don't read normal formats. Takes PGM or PPm formats: http://en.wikipedia.org/wiki/Netpbm_format
-
@whaat said:
@thomthom said:
You would think there would be one but I think everyone Ruby library I have found is just a bridge to another library that was done in C++. (Maybe that's the only way it can be done...)
Odd that there's be no proper ruby library. One, time-consuming way, would be to implement it yourself from the specifications. BMP, PNG, GIF and JPEG specs are available for anyone, I think TIFF is as well. But it's work, at least with the compressed formats. BMPs are pretty straight forwards though.
I was looking into these formats when I was working on a PHP thumbnail extractor. -
You had a look at this one? http://pikl.rubyforge.org/
-
Yet another bridge to a C++ library... (sigh)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement