Export Grasshopper geometry to PNG with specified window

Hello, I am working on creating a series of custom frit patterns for a curtain wall system. I am currently creating a pattern in Grasshopper, baking it, then using the print command to set a window and exporting the file as a PNG. I then bring it into Photoshop where I delete the background and resave the PNG so it has an alpha. That image is linked to a material in Rhino where the curtain wall units are updated with the new pattern. It is currently a tedious process and I have limited myself to a study of five unique patterns due to the amount of time it takes to test each iteration.

Ideally this whole process would take place in grasshopper, and I would only have to bake the final curtain wall to see the results in rendered mode. At the least, I really want to be able to specify a window in grasshopper (the blue rectangle in the image above) and export a PNG (Ideally with a transparent background). It is important that it only saves what is within the bounds of the specified rectangle as I do not want to have to crop each image after export. Every example I have found so far that can export images through grasshopper, can only export a viewport or saved camera and leaves space around the target geometry, which is not what I want. If these images could be exported with the correct crop and as PNG with transparent background, then I could create a larger range of variation and studies. I would prefer to keep this all as native grasshopper components or plugins as needed, as I have no experience in coding, but I would appreciate any help if a custom piece of code is the only way to achieve this.

Frit - Box Random Dissolve.gh (39.5 KB)

If you install the imaging-library plugin via the Rhino Package Manager command you can create images directly in grasshopper. Probably a good place to start automating this.

2 Likes

Wow, that is exactly what I was after. Using the Draw image component from that library, all I had to do was plug my shapes and base rectangle in and set a file path. Now I can watch surfaces with those images mapped update in real time as I adjust my pattern in the script!

Thanks David!
-Mark

2 Likes

Who can show me an example code of how this goes?
I tried to export a line aswel as a filled circle into it and it doesn’t seem to show the wanted result?
Kind Regards.