This is my inaugural ICM blog post. I’m excited to talk about my interest in programming. When I was working with National Geographic magazine, we worked in very close proximity to biologists and other scientists, more often than not photographing living creatures that were part of biological surveys. What this meant for us was being stewards of all of the data that came along with the job. My introduction to code was using Applescripts to concatenate scientific data into coherent captions of photographs, which I more or less stumbled my way through with varying degrees of success.
For more traditional photography, captioning is fairly straightforward, but for us, new discoveries were being made and arguments were being won over taxonomy all the time. This meant that the data affixed to our photographs were perpetually in flux, and we would have to isolate specific data fields and batch change them. Sometimes an animal had yet to be described by science when we photographed it (which was always exciting), and we would have to attach the new species name to all the photographs of it later, for example.
I found it extremely rewarding to make the computer work for me doing what would otherwise be hundreds of hours of tedious data entry. It was satisfying to be victorious over the computer, but I also just enjoyed the puzzle of it.
For my first p5.js sketch I ended up making sort of a space theme. I think I still had the OpenSpace Project from our first Applications session on the brain. The directions were to make basic 2D shapes on a 400x400 pixel canvas. The method for making shapes we were given was to create them with pixel coordinates. My sensibilities as a photographer had a problem with this. The problem for me was that it would be impossible to grow the resolution later, because increasing the canvas size would basically just add a ton of background to the picture, leaving a low-resolution image in the corner. For practical reasons, it also would have been frustrating to work on a high-resolution image in real time.
I asked Professor Allison Parrish to help me resolve this, and she steered me toward using “width” and “height” modifiers instead of pixel dimensions. So instead of creating an ellipse that centered at pixel coordinate 50,60 with a width of 40 and a height 80, I was able to create an ellipse by telling the program to center it 12.5% in from the left, 15% in from the top, and to make it 10% of the canvas wide and 20% of the canvas high. I didn’t use these actual numbers, but I hope this expresses the concept.
I also had some trouble figuring out how to rotate an object. I was trying to put the planet’s orbit on an axis, and it turns out the way to do it is a bit counter-intuitive. You have to temporarily reinterpret the entire coordinate system of the image, and then put it back. I received a lot of guidance from Professor Parrish on this as well.
I was also trying to write some code that would generate stars in the background at random. I succeeded in a sense, but the problem was that the stars would just keep generating into infinity…. appropriate for the theme I suppose. In the end I made the stars manually.
My success was that my program can be easily modified to create this image with infinite resolution. So if the Hayden Planetarium wanted to use my p5.js sketch and project it at 300DPI, it would not be a problem.
Click here to see my first sketch in p5.js.
Click here to see my randomized stars experiment version. (Warning, it’s nauseating).