Randomize from folder of images

Hi everyone, long time Rhino guy here, but pretty new to Grasshopper.

I am looking to create two rectangles in Rhino. Each rectangle cycles randomly through a folder of 2D images. Id then like to batch print each randomized result, I’m hoping to automate the whole process as a way of analyzing the relationships between two images. Any pushes in the right direction would be appreciated.

Ok… I’ve made a little bit of progress, once again, artist here not a developer, so much thanks in advance. Here’s my progress so far:
Improvements I need some guidance on:
-I’d like to have a push button that will activate my random function so every time I click the button I get a new image, I dont like the list.
-Right now I’m pulling all the files into grasshopper which takes some memory, is there a way to just have the folder location and randomly pull from that list, or even better make a list of URL links that it can randomly pull from. (Image Gallery does this)

thanks again for your help :pray:

Hello Chris,

There is no native bitmap support inside GH, but you can use these plugins below:

also for the screenshot, you can use Human:

Thanks for the plugin links! I’m tinkering with them now. Here’s where I’m at so far(once again, not a cs guy… so appreciate the help:

I can randomize the images in Rhino, but its still all based on a drop down. I want to have a button that randomly picks one of the images from a file of 100 images. So I can click and it produces a new set. I think I’m close with this set up, but my method for randomizing is clunky, Im wanting a sort of wheel of fortune: spin the wheel= get a new image.

I’d love to have it do a batch process much like you can do with photo shop, and kick out 1000 jpgs, each a new randomized pair. I don’t need to see the jpgs till the end.

Woah, these plugins are great! More to come shortly…

1 Like

You can set up a loop using anemone plugin make multiple animated random shapes by increasing the random seed value by +1

1 Like

Now if I can only figure out how to get all of these plugins to show up in the GH component tabs… some of them work, other dont. I cant get Anemone to show up in the tab.

pesky unblock box… got it going!

1 Like

Yeah it became a habit for me to unblock everything.

You got me excited to see your final results. It is a very unique implementation for Grasshopper.

I got the Anemone to create the loop for the seed in AutoEntourage, Can you give me some tips on having it ping a True signal after every new integer input so it uploads a new variation of images?

ImageImport04.gh (28.8 KB)

the more I tinker, the more I figure out, was able to send that true command with larger than operation, now we’re cooking!! next to get it to print out the results after each cyle :guitar:

You are a real model for me when it comes to never giving up!
Try this:

plug this part of definition to your definition, this should start automatically generating output images from your viewport.

Save Viewport to File.gh (7.5 KB)

and that is a much more efficient version, thanks :pray:
one more question, I’d like each screen shot to be saved as a new name (screenshot01.png, screenshot02.png), the ‘save viewport to file’ tool turns up as an error when I give it a folder or directory, but will work if I give it a file name (eg. screenshot.png), problem is that it’ll keep on saving using that same name, overwriting the file. what am I missing?

You can use the Concatenate tool to combine text with the Counter output from anemone. it will generate 1 file for every anemone run.

also, It is funny that I forgot to tell you about my plugin Grasshopper counter, you can generate 1 screenshot a specific period of time. It is not a plugin, it is, more like a python script.

1 Like

woah! that counter is slick!! do you know of a plugin that would run the print function in rhino and let me adjust the parameters of the print(resolution, cropping, etc.) the screen shots are fine, but I’d like to kick out higher res images.

1 Like

So far, I’m not aware of any print functionality plugin:

But you can add a scale factor to increase your output resolution (I suggest scale of 2 to 3)

1 Like

Thank you, that’s very helpful, I’ve grown to love the versatility of the Rhino Print function, especially since I can have control over just about everything within the viewport mode, no need for render wait times, lots of options. I’ll keep looking for a plugin, or maybe someone will see this and develop one… I need to learn how to write code :upside_down_face:

By the way, I checked out your work, very cool stuff. I especially like some of those animations using a gridded mat board. :exploding_head:

1 Like

Thank you, and glad that you made it work, I think Getting into C# with Rhino/Grasshopper is a great skill to acquire. :slight_smile:
and I really enjoyed your work on your website, especially the fabricated wood concepts, you should definitely post them on the Gallery section of this forum.

1 Like