Radial Gradient on surface/mesh and Export Image JPG/PNG

HI everyone, I’m new to Rhino/GRasshopper and I want to do something that seems to be really basic, but I can’t wrap my head around it.

I want to do 2 things:

  1. Create a radial gradient in a surface or mesh.
  2. Export a bitmap image (jpg, png, bmp, tiff, or whatever) using a rectangle curve that should work as the “frame” for the “canvas” of the image.

In this example the pink rectangle should be the “canvas” of the exported image, and the circle is the surface/mesh to receive the radial gradient.

Final result of the image should be something like this:

It would be great if I could control how the colors interpolate.
Here is another example with a different setup for the gradient: less steps between one color and the other, and the dark color is more towards the center.

As a bonus, but less important, it should work with ellipses as well, and if the surface is “cutted” or deformed somewhow, the gradient should maintain the same radial essence, without breaking.

gradient_and_export.gh (9.1 KB)

Anyone could point me to the right direction?
I don’t undertand how to use Gradient, Radial Gradient Fill, Fill Radial components.

Thank you!

This could be a way…

gradient_and_export_re.gh (15.1 KB)


And check this as well.

gradient_and_export_reV2.gh (18.1 KB)


@HS_Kim wow, thats pretty much what I needed for the gradient.
Thank you so much for helping me so fast! I really appreciate your help.
I will study the code closer to better understand how you made the gradient.

What about the ideia of exporting the image as a bitmap, using the rectangle as the “canvas”, width and height of the image?
Anyone can point me to right direction on that?

I added the cluster for image capture of the Top viewport, just edit the Path & Filename and you are good to go.

If you are asking about the source of this cluster, it is from Fabtools

gradient_and_export_reV2_Capture.gh (54.5 KB)