Grasshopper

algorithmic modeling for Rhino

Every time I use the image sampler I have to assign the size like 800*600 by myself. Is there a way to get the size information of the image?

Views: 2320

Replies to This Discussion

You should reparameterize the input if possible... By doing that you will not need the manual reassignment of bounds...
Hi Daniel,

currently not possible, sorry. I figured you'd only care about the physical dimensions of the image, not the pixel dimensions. It's easy enough to add a button that copies the image pixel dims into the physical dimensions text-fields. I'll try and include it into the next version.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Hang on... what would be the best domain for a 800*600 image?

{0 To 800} & {0 To 600}

or

{1 To 800} & {1 To 600}

or

{0 To 799} & {0 To 599}

or

{-400 To 400} & {-300 To 300}

or...

--
David Rutten
david@mcneel.com
Poprad, Slovakia
At any rate, added a button to the Image Sampler dialog:


--
David Rutten
david@mcneel.com
Poprad, Slovakia
The second option, {1 to 800} & {1 to 600} would get my vote. The last two have the potential to be confusing (I think its important to have the last number be the dimension of the image). And if you're going to have the last number be the number of pixels, then it should start at one.
Although I think the current {0-1} is quite versatile and easy to understand, if this were to implemented anyway, I'd go for {1 to 800} & {1 to 600} too.
Thanks to all replies:)
Maybe I didn't get myself clear. I mean if I input a 800*600 pixel image in the image sampler, how can I get the "800" and "600" in grasshopper?
You can't, you'll need to examine the image with a VB component instead.

--
David Rutten
david@mcneel.com
Poprad, Slovakia

Hi David.

Do you know where can I find the VB Script to get the image size ("600" and "800" from the example) ? Or perhaps could you share it?

Thanks

Private Sub RunScript(ByVal x As String, ByVal y As Object, ByRef A As Object, ByRef B As Object)

Dim bitM As New System.Drawing.Bitmap(x)
A = bitM.Width
B = bitM.Height

End Sub



Remember first to change x input to string type and add B output... then paste the code

Thanks a lot! Just what I needed.

By the way, I like {0 To 799} & {0 To 599}. This may make scripting less confusing.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service