Grasshopper

algorithmic modeling for Rhino

I was wondering if anyone knows a simple way to output the x and y pixel size from an image loaded into the image sampler.

Thanks

Carl

Views: 1802

Replies to This Discussion

Not simple, but you can try this:

Image Sampler settings: Clamp, Filter:colour and Use image pixel dimensions

It is a bit annoying as you have to load your image twice, first time in the sampler used to get image size, and second time in the sampler you actually use.

Great!.. looks like you did what I thought of doing... evaluating a clamped image and seeing what points are within the area.  thanks.  I was hoping I was missing something simple and obvious.

Thanks

There was a VB.NET component too, written by Mateusz Zwierzycki, some time ago:

Yoann, can you please explain the logic behind your solution? Sorry for ignorance.
Merci

Attachments:

Thanks... works perfect.  It's time like this when I wish I knew how to code!

Carl

When the Tiling is set to Clamp, the points going out of the image will have some default value.

Transparent if the Filter is set to Color, 1.0 if set to Value(brightness), etc...

So if you generate a large number of points in X and Y, they will eventually leave the image range and give the default value. So you can find the points in range, so the dimensions.

Problem is there could actually be some transparent points in the image, which will bug the process.

Very interesting.

I think I will have to look at the Match string component first and what it does, and then try to understand the rest of the solution.
Thank you!

Man, where did you find it ?! :D I had to search my head quite a long to remind this script myself.

I had it bookmarked since May last year :)

Do you want to use the pixels later on or just display them? If you hover the mouse over the load icon, it will show name and resolution of the file.

Needed the output... I knew that I could get the info by hovering the mouse, but wanted to get the actual numbers to use as data.  See above... they gave me a few options.

Just wanted to make sure you're not using a sledgehammer to crack a nut. Since you'd have to manually load the image file anyway, Systemiqs solution seemd quite overkill compared to hovering the mouse and manually adjusting two more values. The VB script is nice and simple though.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service