Help: Get floating point value from tiff, but i get values of 255

Here the example. I hope the extra text around it makes it clear what is done and in most cases why.

First part of the output with the example script:

/Users/nathan/Downloads/DTM_32-1-514-134-76 2.exr
118.172 118.172 118.172 1.0
118.188 118.188 118.188 1.0
118.203 118.203 118.203 1.0
118.234 118.234 118.234 1.0
118.265 118.25 118.265 1.0
118.250 118.235 118.250 1.0
118.203 118.203 118.203 1.0
118.157 118.157 118.157 1.0
118.094 118.094 118.094 1.0
118.032 118.032 118.032 1.0
117.954 117.954 117.954 1.0
117.861 117.861 117.861 1.0
117.797 117.797 117.797 1.0
117.796 117.796 117.796 1.0
117.782 117.782 117.782 1.0
117.750 117.750 117.750 1.0
117.705 117.705 117.705 1.0

If you saved this from the 1-channel TIFF then you’ll probably want to use only col4f.R.

I completely agree - I just didn’t think that doing some extra steps in Blender was getting this any closer. If you need an external app to convert something, you might as well not use Blender.

1 Like

Blender is here a red herring. Since @Holo has access to Photoshop I’m sure he’ll be using that to create his files. Just any tool to convert the TIFF to an EXR, and probably can be scripted too. I don’t have Photoshop, but I do have Blender - so I used that to test :slight_smile:

addendum: I noticed I had forgotten to type a bit about evaluator flags, so I did just that and pushed the updated text. Should be on the earlier linked page soon if not already - refresh until there is text prior to the code fragment for getting the texture evaluator.

Unless I’m very wrong, the entire story here isn’t just getting some pixel values into Rhino. Those pixels represent values in latitude, longitude, and elevation. Depending on where on Earth this area is from, the resulting x,y,z values will be different.
I’d love all of this to be handled natively inside of Rhino but if you need any external application at all to start converting things, you might as well use one that does all of this correctly right away and not additionally have to jump through hoops in Rhino coding.

1 Like

Maybe so. The question was how to get the one-channel TIFF (height data) read in Rhino which I set out to answer. The code given does that, just not for the TIFF format as Rhino currently is unable to do so. But it can with other formats that are capable of the same.

Once the YT I logged is fixed the code can be adapted to directly use the TIFF.

1 Like

Hi @nathanletwory any news on this?
We would benefit so much from being able to import this data directly to Rhino.

No news yet, it is on the list of @andy .

@andy are there anything I can do to bribe you to put this on top of the list? :wink:

Bumping this :slight_smile:

here’s something you could use in the meantime

import clr
import bella

s = bella.Scene()

t = s.createNode('fileTexture')

r = t.output('outRes').asVec2()
o = t.output('outVector')

for y in range(0, int(r.y)):
  for x in range(0, int(r.x)):
    uv = bella.Vec2((x+0.5)/r.x, (y+0.5)/r.y)
    v = o.sample(uv)
    if x == 0:
      print('[%d %d] %s [%f %f %f]'%(x, y, uv, v.r, v.g, v.b))

it will read most formats handled by openimageio

1 Like

I guess this is an obvious question, but this requires Bella to be installed on the computer, right?
I need to be able to use this on multiple machines, and not only my own :slight_smile:

yes it would require installation, it is just using the sdk library installed & used by the plugin

1 Like

Great, thanks!
This way I can at least make and test the plugin and then swap out the Bella part when something else is cooked up :slight_smile:

1 Like

exactly what I was thinking :+1:

1 Like

Thanks for taking the time and for thinking ahead for me!

1 Like