Infinite Dimensions

Image Sampler in Grasshopper

Image Sampler in Grasshopper

What is image sampler

The Image Sampler in Grasshopper is a component that allows you to extract data from an image and use it to drive your design. Instead of manually defining values, you can use the colors or brightness levels of an image as input parameters within your workflow.

This makes it possible to translate visual information—such as gradients, textures, or patterns—into parametric control. Whether you’re developing a façade system or generating landscape forms, the Image Sampler helps bridge the gap between visual inspiration and computational design, enabling more intuitive and expressive outcomes.

How to Import an Image into the Image Sampler In Grasshopper

  1. Place the Image Sampler component onto the Grasshopper canvas
  2. Double-click the component to open the Image Sampler Settings
  3. Click the three dots next to File Path to browse and select your image

Once the image is loaded, it will be displayed in the preview panel within the Image Sampler Settings window.

How image sampler works

The Image Sampler works through three main parts: input, image, and output. You start by giving it coordinates (X and Y values), which tell the component where to look on the image. It then reads the pixel at that exact spot and sends out the information—usually color or brightness values. These values can then be used to control different elements in your design
To get consistent and predictable results from the Image Sampler, the most important part is how you handle the sampling process. The coordinates you provide must correctly relate to the image.

For example, if your image is 100 × 100 pixels and you try to sample a point at (0, 300), that point lies outside the image. In other words, it’s out of bounds, so the sampler won’t return meaningful data.
To avoid this, the coordinate range (or domain) of your inputs should match the dimensions of the image. This ensures that every sample point falls within the valid area of the image.
To achieve a clear and detailed result, it’s important to use a higher number of sample points—similar to increasing the resolution of an image. The more points you sample, the closer your design will match the original image.

A common approach is to distribute these points evenly by creating a grid across the image. This can be done in different ways, such as subdividing a surface or generating a structured set of points.
Before getting into those methods, let’s first understand what kind of output the Image Sampler provides.

Channel Settings – Understanding the Image Sampler’s Outputs

The Channel setting in the Image Sampler determines what type of information is extracted from the image.

Every color in an image is made up of three components: Red, Green, and Blue (RGB). When you sample using the full RGB option, the Image Sampler returns all three values for each point—representing the exact color at that location. This is especially useful when you want to apply image-based colors directly to your geometry.
Other channel options simplify this data by focusing on a single property. Instead of returning three values, they output just one number.

For example, the Brightness channel converts the sampled pixel into a value between 0 and 1, where 0 represents black and 1 represents white. This is commonly used to control parameters like height, scale, or density in a design.
In a black-and-white image, black corresponds to 0 and white to 1, while all intermediate shades of gray are represented by values in between.
For instance, a mid-gray tone would have a value around 0.5.

Understanding the Image Domains

In the Image Sampler Settings window, the first two fields define the X and Y domains.

By default, both domains are set from 0 to 1. This means the image is normalized, where (0, 0) represents one corner and (1, 1) represents the opposite corner. For example, a coordinate like (0.5, 0.5) will sample the pixel at the center of the image.You also have the option to match the domain to the actual resolution of the image.

This can be done using the small icon next to the domain settings. When enabled, the domain reflects the image size—for instance, a 500 × 500 image will have domains ranging from 0 to 500 (or 1 to 500, depending on settings).

In this case, the domain is set to match the actual resolution of the image. The X domain ranges from 0 to 1200, and the Y domain from 0 to 1153, meaning coordinates directly correspond to pixel positions.
The values displayed around the preview indicate the minimum and maximum limits of these domains.
Regardless of how the domain is defined, it is important that the sample coordinates stay within the same range. Any values outside this domain will not return accurate results.
In most workflows, using a normalized domain of 0 to 1 keeps the system consistent and easier to manage.

Download the Image Sampler template script

resource download form
Scroll to Top