Dear reader, in this notebook, we recover the original Pixel Art after it is been shared by third-party software which changes the resolution of the original art introducing artifacts. It was another fruitful challenge at the Wolfram Hackathon Brazil 2021!
Everyone is familiar with pixel art. It has become a deep part of our entire global culture since the launch of PONG, Pac-Man, Mario Brothers, Donkey Kong, etc. At this point in time Pong was released in 1972, meaning that 49 years have gone by where pixel art has represented our connection to the digital, and no matter how complex graphics get somehow we cannot seem to escape the friendly aesthetic of this work.
Recently with the emergence of NFT art, this has presented itself again with sales of "crypto punks" for millions of dollars. When many of the works on NFT platforms are rendered at the highest quality level with complex 3D simulation work, why is "crypto punks", which is often made of a grid of 24x24 pixels, so emblematic of our emotional investment in the digital space?
The clear answer to me (Andrew), as a former pixel artist in my youth, is very simple: YOU DON'T HAVE TO KNOW HOW TO DRAW to be a pixel artist. If you can organize a small group of pixels on your screen to look like a panda bear, it will be hard to not be charmed by your creation.
In the current NFT space where relatively unknown artists who were often held back by huge gatekeepers in the art market can create and sell works for thousands if not millions of dollars from their very own laptop, the generative pixel art NFT's are taking over as a new form of "street" art and culture, filling up a similar space to graffiti.
In my dealings with this space, the tools are very simple, however, there are many innovations coming in as people get more and more excited by not only pixel art but also VOXEL art which is becoming a quick favorite in the Metaverse. This work is being seen in entertainment and blockchain-related projects such as Minecraft and Sandbox.
Since the launch of the Web, pixel art is mostly found being presented online in a scaled-up format. The reason this is often done is that web browsers have anti-aliasing which will keep the pixel-accurate work from being seen properly. It is often blurry and hard to see what the image looks like.
This presents a problem for pixel and voxel artists. What if we want to take some pixel art off of the internet and bring it back into our software to keep playing with the image, but all that is to be found is the upscaled image? At this point begins a very time-consuming process of re-doing the work pixel by pixel, or going into Photoshop and counting the pixel count of 1 pixel and shrinking the image by that amount.
This however is completely unnecessary to do if we are sitting at a computer, which should be a tool to help us take care of such problems. Here are steps in Wolfram to the rescue, where we decided to find a way to batch this process by doing an analysis of these upscaled pixel art images off of the web in order to find the size and shrink them back down to size accurately.
There were several challenges presented in this process that had to be dealt with. If the pixel art is scaled up new colors are added to the edges of each pixel due to the antialiasing and interpolation of the data. This creates irregular positioning for each pixel.
There were a few approaches to this project, there was a path by using "find corners" and then searching for "nearest neighbors" to find the shortest path that would reveal the pixel length, as well as using the Fourier transform method, and a third and very interesting option whereby an analysis of the scaling of the image was conducted at all sizes below its original size under the assumption that the correct version would contain the LEAST amount of colors due to the lack of any aliasing.
Below are all the findings, enjoy!