Creating a Vector Graphics Version of the Arecibo Message

Tags: Arecibo Message , Processing

(Español: Creación de una imagen vectorial del mensaje Arecibo para imprimir)

I recently remembered the very cool Arecibo message and I discovered today that the Wikipedia article on it is truly fantastic. After reading about the meaning of all the parts of the message, I decided I wanted a printed copy for my home. In this post I describe how I generated the print-ready image file.

Here is the message:

Arecibo Message. Image from Wikipedia by Arne Nordmann (norro), CC BY-SA 3.0

Arecibo Message. Image from Wikipedia by Arne Nordmann (norro), CC BY-SA 3.0

In the Wikipedia article they explain in detail the meaning of all the parts (I will not go into the details because the Wikipedia article is already doing a fantastic job). It is so cool!

The message has an incredible amount of information packed into just 1,679 ones and zeros (colors are not part of the original). Then again, the fact that $1,\negthinspace679=23\times73$ is a product of two primes means that there are only two ways to organize the ones and zeros into a rectangle, one of which gives gives the message. So clever!

Here is the full message in its raw binary form with 0s and 1s:

00000010101010000000000001010000010100000001001000100010001001011001010101010101010100100100000000000000000000000000000000000001100000000000000000001101000000000000000000011010000000000000000001010100000000000000000011111000000000000000000000000000000001100001110001100001100010000000000000110010000110100011000110000110101111101111101111101111100000000000000000000000000100000000000000000100000000000000000000000000001000000000000000001111110000000000000111110000000000000000000000011000011000011100011000100000001000000000100001101000011000111001101011111011111011111011111000000000000000000000000001000000110000000001000000000001100000000000000010000011000000000011111100000110000001111100000000001100000000000001000000001000000001000001000000110000000100000001100001100000010000000000110001000011000000000000000110011000000000000011000100001100000000011000011000000100000001000000100000000100000100000001100000000100010000000011000000001000100000000010000000100000100000001000000010000000100000000000011000000000110000000011000000000100011101011000000000001000000010000000000000010000011111000000000000100001011101001011011000000100111001001111111011100001110000011011100000000010100000111011001000000101000001111110010000001010000011000000100000110110000000000000000000000000000000000011100000100000000000000111010100010101010101001110000000001010101000000000000000010100000000000000111110000000000000000111111111000000000000111000000011100000000011000000000001100000001101000000000101100000110011000000011001100001000101000001010001000010001001000100100010000000010001010001000000000000100001000010000000000001000000000100000000000000100101000000000001111001111101001111000

If one were to restrict the width of the text above to exactly 23 characters, one would see a faint version of the wikipedia image made out of 1s and 0s. As I wrote this I could not stop myself from attempting this, so here it is!

Creating a high quality two-color version for printing

The Wikipedia image can be downloaded as an svg vector graphic (suitable for printing), but I did not like the added colors. I wanted a simpler version the 1s being dark boxes and the 0s being white space. After some Googling I bumped into a code to generate it by Rupert Russell. His code generates a png version (not so suitable for printing), but after some tweaking I had a code that generates an svg image.

Here is my adapted code:

/* Enrique Acosta, 2022
 * Runs with Processing 4 (beta)
 * Based on the code by Rupert Russell downloaded from
 * http://rupert.id.au/tutorials/processing/examples/Arecibo_message_001/index.php
 * Licence Createive Commons 
 * Under the following terms:
 * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
 * ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
 * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
 * https://en.wikipedia.org/wiki/Arecibo_message 
 */
 
import processing.svg.*;
int black; 
int white;
int pixelSize = 50;
int m; 
// message 
int[] message = {0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1,1,1,1,0,1,0,0,1,1,1,1,0,0,0};

void settings(){
  size(pixelSize*23, pixelSize*73, SVG, "Arrecibo.svg");
}

void setup() { 
  //rectMode(CORNER);  // Default rectMode is CORNER
  strokeWeight(1);
  //noLoop();  // Run once and stop
  black = 0;
  white = 255;
  m = 0 ; // start at the first pixel in the message
}

void draw() {
  for (int r = 0; r < 73; r = r +1){
    for (int c = 0; c < 23; c = c+1) { // 22 columns in the message
      if (message[m] == 0) {
        fill(white);  // Set fill to white  
        stroke(black);
      }
      if (message[m] == 1) {
        fill(black);  // Set fill to black
        stroke(black);
      }
      rect(c * pixelSize , r * pixelSize  , pixelSize , pixelSize );
      m = m + 1; // read the next pixel in the message
      if (c > 23) {
        r = r + 1;
        c = 0;
      } 
    }
  }
  // Exit the program
  println("Finished.");
  exit();
}

This code runs on Procesing 4, a really nice “learn to code by producing graphics” language and open source compiler. There is a very fun Youtube Channel, The Coding Train, in which one can quickly see the very cool things one can do with relatively simple code. See also the official Processing site.

Anyway, back to the code, here is the image it creates. Ready for printing!

Subscribe

Want to get an email when a new post is added? If so, subscribe here.