Creación de una imagen vectorial del mensaje Arecibo para imprimir

Etiquetas: Mensaje de Arecibo , Processing

(English: Creating a Vector Graphics Version of the Arecibo Message)

Hace poco recordé el mensaje de Arecibo y descubrí que el artículo de Wikipedia es excelente. La versión en inglés es un poco más completa. Al leer sobre el significado de cada parte del mensaje, decidí que quería una copia impresa para mi casa. En esta entrada de blog describo cómo generé una imagen de buena calidad para impresión.

Este es el mensaje:

Mensaje de Arecibo. Imagen de Wikipedia elaborada por Arne Nordmann (norro), CC BY-SA 3.0

Mensaje de Arecibo. Imagen de Wikipedia elaborada por Arne Nordmann (norro), CC BY-SA 3.0

En el artículo de Wikipedia explican en detalle el significado de cada una de las partes del mensaje (no entro en detalles porque en el artículo de verdad hace una excelente labor). ¡Es muy interesante!

El mensaje tiene una cantidad impresionante de información en tan solo 1,679 unos y ceros (los colores no hacen parte del mensaje original). Algo muy ingenioso es que $1,\negthinspace679=23\times73$ es el producto de dos números primos, entonces hay solo dos formas de organizar esos 1,679 unos y ceros en un rectángulo, y una de esas formas da el mensaje.

Este es el mensaje en su forma binaria sin procesar:

00000010101010000000000001010000010100000001001000100010001001011001010101010101010100100100000000000000000000000000000000000001100000000000000000001101000000000000000000011010000000000000000001010100000000000000000011111000000000000000000000000000000001100001110001100001100010000000000000110010000110100011000110000110101111101111101111101111100000000000000000000000000100000000000000000100000000000000000000000000001000000000000000001111110000000000000111110000000000000000000000011000011000011100011000100000001000000000100001101000011000111001101011111011111011111011111000000000000000000000000001000000110000000001000000000001100000000000000010000011000000000011111100000110000001111100000000001100000000000001000000001000000001000001000000110000000100000001100001100000010000000000110001000011000000000000000110011000000000000011000100001100000000011000011000000100000001000000100000000100000100000001100000000100010000000011000000001000100000000010000000100000100000001000000010000000100000000000011000000000110000000011000000000100011101011000000000001000000010000000000000010000011111000000000000100001011101001011011000000100111001001111111011100001110000011011100000000010100000111011001000000101000001111110010000001010000011000000100000110110000000000000000000000000000000000011100000100000000000000111010100010101010101001110000000001010101000000000000000010100000000000000111110000000000000000111111111000000000000111000000011100000000011000000000001100000001101000000000101100000110011000000011001100001000101000001010001000010001001000100100010000000010001010001000000000000100001000010000000000001000000000100000000000000100101000000000001111001111101001111000

Si uno restringe el ancho del texto a 23 caracteres, se puede ver una “sombra” de la imagen de Wikipedia hecha con los caracteres 0 y 1. Aquí está el resultado:

Creación de una versión del mensaje en dos colores de buena calidad para impresión

La imagen de Wikipedia se puede descargar como una imagen vectorial en formato svg (bueno para impresión), pero no me gustaba que tuviera colores. Quería una versión más simple, con cuadrados blancos para los 0 y negros para los 1. En una breve búsqueda en internet me topé con un código de Rupert Russell para generar algo por el estilo. Su código generaba un archivo png, que no es tan bueno para impresión, pero después de algunos ajustes al código logré que generara un archivo vectorial svg.

Este es el código ajustado:

/* 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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  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();
}

El código corre en Procesing 4, un lenguaje de programación y compilador de código abierto enfocado en “aprender a programar haciendo dibujos y obras artísticas digitales”. Hay un canal de Youtube llamado The Coding Train donde se pueden ver ejemplos interesantes de lo que se puede hacer. También es recomendable visitar la página oficial de Processing.

Aquí está la imagen generada por el código. ¡Listo para imprimir!

Suscríbase

¿Quiere recibir un email cuando haya una nueva entrada de blog? Suscríbase acá.