The other day, after a relaxing trip to the beach, I came back with a boatload of rocks—each one unique in shape and texture. Below is a photo of a turtle I “put” together using rocks from the beach and which I later painted using oil pastels.

As I was admiring my collection, a curious idea struck me: What if I could identify different rock types from a photo, and then arrange them into creative shapes—like animals or birds?
That got me thinking—could I actually code something to do this? Python seemed like a natural choice for the task. While I’m not a Python programmer by trade (my coding journey started way back with BASIC), I’ve always had a knack for logic and modifying code in various languages. Writing a complete Python program from scratch, though, would take time.
That’s when I thought: Why not ask ChatGPT—specifically GPT-4o—for help? So I typed in a prompt explaining what I wanted to achieve.
To my surprise, ChatGPT quickly generated a Python script that looked promising. Being the skeptic I am, I didn’t expect it to work on the first try—and it didn’t. But after feeding it the error message, ChatGPT adjusted the code, and when I ran it again… it worked! It was simple, nothing flashy, but it did exactly what I needed.
Feeling inspired, I took it a step further and asked it to arrange the individual stones into the shape of an owl. It took a while but eventually, it produced an image of an owl made from the rocks in my photo… plus a few extras that weren’t originally there! At first, I thought, well that’s not ideal. But then I figured, why not turn this into another adventure? So I headed back to the beach to hunt for similar rocks to complete the scene.
Either way, it was a real “hoot!”. You can see my rock owl in the photo below.

If you’re curious to see the code or want to try it out yourself, I’ve uploaded everything to my GitHub repository. Be sure to read the README file for instructions first.
I wrote this blog because, with all the hype around AI, I wanted to test whether it could actually do something for me. In this case, it absolutely did—and I was genuinely amazed.
My next project? Trying to “hear” the energy levels of different atoms. But that’s a story for another blog.
If you end up using the rock-sorting code (it doesnt have to be rocks, you can tag any object you specify in any photo) in your own way, I’d love to hear about it.
I don’t understand. Let us say I gather 10 rocks of different shapes and sizes on the beach, then photograph them together and feed the image into the AI algorithm. The algorithm then returns an animal or bird or… whatever made from those rocks. Correct?
Thank you for your comment. A clarification is in order. My first aim was to take a photo of the rocks (however many) together and then feed the photo to chatgpt and have it identify each rock in the photo and then use those rocks to make the animal that I asked it to. However, I ran into issues with the first part as the AI was unable to extract each rock from the photo. So I decided that a simpler approach would be to have it write me a python code which would enable me to tage and identify the rocks in the photo and then have it save the rocks individually as separate picture files. Then, I had it write me another piece of code where it would allow me to use those individual rocks and place/move them in a template while allowing for full rotation so I could manipulate the rocks like jigsaw pieces to form shapes. I then later uploaded the photo containing the rocks to chatgpt and asked it to create an owl from the rocks. This time it did a better job of identifying the rocks but it also added in a few more of its own (not in the photo) and created an owl and output the photo to me. Though not ideal, that allows me to search the beach for the missing pieces and complete my “rocking” owl. So one can try either approach and use the one that works best for their particular application. Hope that clarifies the post.