Claudio Gomez, tarea 8

De Casiopea
Pixelación de Imgaen


TítuloPixelación de Imgaen
Tipo de ProyectoProyecto de Curso
Palabras Clavetarea 8
Período2012-
AsignaturaImagen Escrita 2012,
Del CursoImagen Escrita 2012,
CarrerasDiseño Gráfico"Diseño Gráfico" is not in the list (Arquitectura, Diseño, Magíster, Otra) of allowed values for the "Carreras Relacionadas" property., Diseño Industrial"Diseño Industrial" is not in the list (Arquitectura, Diseño, Magíster, Otra) of allowed values for the "Carreras Relacionadas" property.
Alumno(s)Claudio Gómez
ProfesorHerbert Spencer

import processing.pdf.*;

PImage foto; // la foto: el encuadre, la escena, el paisaje PFont font; // la fuente tipográfica String[] code; // el texto del código

/* Al exportar un PDF, Processing translada

las unidades de pixeles a puntos tipográficos.

1 pt = 0.0352778 cm
1 cm = 28.346438837 pt
  • /

float margenIzquierda = 30; float margenArriba = 80; float margenDerecha = 20; float margenAbajo = 20; float escala;

void setup() {

 foto = loadImage("cielos.jpg");   // se carga la imagen, se "construye" el objeto PImage foto
 size(609, 765, PDF, "Paisaje.pdf");  // tamaño carta
 // cálculos para escalar desde la imagen hacia el pincel
 float ancho = width - (margenIzquierda + margenDerecha);
 escala = ancho/(float)foto.width;
 noStroke();
 noLoop(); 
 background(255);
 font = createFont("Courier", 8); // construyo la tipografía a partir de una fuente de sistema
 textFont(font, 8);
 code = loadStrings("trazo.pde"); // cargo el código "trazo" (el pincel)

}


void draw() {

 float spacer = 10;
 // muestreo regular desde la foto, esto se puede modificar....
 for (int y = 0; y < foto.height; y += spacer) {
   for (int x = 0; x < foto.width; x += spacer) {
     // obtengo el color
     float plotX = map(x, 0, foto.width, margenIzquierda, width-margenDerecha);
     float plotY = map(y, 0, foto.height, margenArriba, margenArriba + (foto.height * escala));
     color c = foto.get(x, y);


     trazo(plotX, plotY, c, spacer);
   }
 }
 printCode();
 println("----->PDF done!");
 exit();

}

void printCode() {

 float interlinea = 0;
 for (int i = 0; i < code.length; i++) {
  
   text(code[i], width/4, 2 * margenArriba + foto.height * escala + interlinea);
   interlinea += 15;
   text("Claudio Gomez, Diseño",50,690);
 }

}

/************** trazo *************/

int r=round(random(15)); void trazo (float x, float y, color c, float amp) {

 fill(c);
 rect(x, y, 86, 69);
ellipse(x,y+5,r,r);
}