sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    How to get a pixel value from an image file?

    Scheduled Pinned Locked Moved Developers' Forum
    9 Posts 4 Posters 672 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W Offline
      Whaat
      last edited by

      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.

      SketchUp Plugins for Professionals

      1 Reply Last reply Reply Quote 0
      • PixeroP Offline
        Pixero
        last edited by

        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?

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          @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.

          Thomas Thomassen — SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • W Offline
            Whaat
            last edited by

            @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. 😄

            SketchUp Plugins for Professionals

            1 Reply Last reply Reply Quote 0
            • W Offline
              Whaat
              last edited by

              @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?

              SketchUp Plugins for Professionals

              1 Reply Last reply Reply Quote 0
              • thomthomT Offline
                thomthom
                last edited by

                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

                Thomas Thomassen — SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  @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.

                  Thomas Thomassen — SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • thomthomT Offline
                    thomthom
                    last edited by

                    You had a look at this one? http://pikl.rubyforge.org/

                    Thomas Thomassen — SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply Reply Quote 0
                    • R Offline
                      RickW
                      last edited by

                      Yet another bridge to a C++ library... (sigh)

                      RickW
                      [www.smustard.com](http://www.smustard.com)

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      • First post
                        Last post
                      Buy SketchPlus
                      Buy SUbD
                      Buy WrapR
                      Buy eBook
                      Buy Modelur
                      Buy Vertex Tools
                      Buy SketchCuisine
                      Buy FormFonts

                      Advertisement