Grasshopper (Image sampler)

Topic_01: Image Sampler

  1. In the Grasshopper ribbon, select the Params Tab>Input>Image Sampler (Image). Alternatively, you can double click the background of Grasshopper and type ‘image.’ A component appears with an exclamation mark in the center (Because currently there is no image set).
  2. Double click the near the exclamation mark, a new window appears.
  3. In the File Path section in the window select the “” button. A new window appears prompting you to specify an image from your computer. Navigate to your desktop and select the “LASER” image or the “Mt. Hood” image that you downloaded from Canvas earlier. Once you have selected the image, you’ll see a preview of the image to the left.
  4. In the Channel section notice that there are 8 different icons and if you hover over them highlight their specific function (i.e RGBA Colours, Red Channels, Green Channels, etc) The far right icon is labeled “Colour Brightness” ensure it is selected by clicking on it.
  1. In the Channel section ensure that the “Interpolate” option is checked.
  1. In Tiling section click the double dropdown menu which is currently set to “Tile” and change it to “Clamp”
  1. Next we’re going to have to change the X-Domain and Y-Domain which both are currently set to “0.0 to 1.0” since earlier we changed our number slider to input numeric values up to 1000 well go ahead and change the X-Range to “0 to 300.0” and the Y-Range to “1.0 to 300.0” (Think of this in a way of pixel count in the x/y direction of an image.)
  2. Click OK.
  3. To view the results from the Image Sampler in Rhino, we will need to construct components to tell the information where to go and how to be shown.
  4. Create a SquareGrid component (shown under ‘Square’ if searched) and place it to the left of the Image Sampler component. Connect the P output from SqGrid to the input of the Image Sampler.
  5. To create a grid for each “pixel” of the image you will need to create number sliders for the Ex and Ey values of the SqGrid component. The slider will need to be set to half of the value we set above. Double click the Grasshopper background and type ‘150’ press enter and a Number Slider set to 150 should appear. Connect the output of the slider to Ex and Ey of the SqGrid component.
  6. By default the size of each pixel will be set to ‘1’ unit within the Rhino canvas. Create a Panel with a value of ‘2’ by double clicking the Grasshopper background and typing ‘”2’ into the search bar. Press enter and a Panel with a ‘2’ should appear. Connect the output of this panel to the S of the SqGrid component.
  7. Finally, we need to create a geometry unit in each grid cell to act as our “pixel.” Create a CircleCNR component by searching for it in Grasshopper or selecting it from the Curve>Primative menu in the Grasshopper ribbon.
  8. Connect the “P” output from SqGrid to the “C” input of the Circle component. Then, connect the output from the Image Sampler component to the input “R” of the Circle component. In Rhino this should create a circle in each of the grid cells, centered at the centroid of the cell and with a radius matching the amount of black in each “pixel.” Right click on the center of the SqGrid component and click “Preview” this will hide the grid and allow you to see all of the “pixels” in Rhino.

Script 3.1d: 3D sub-divided NURBS surface point-attractor

LAB SESSIONS: Image Sampler
Script 3.1e: simple image sampler (circles varying radii based on referenced image)

Skip to toolbar