Recently I've been looking at Povray, pyprocessing, and cfdg (version 3.0) as tools for creating digital images. I have branched two separate blogs where I mainly explore jruby + processing and

Friday, 15 June 2012

Pixelation in processing using cfdg

Well this is pretty weird, pointless may'be, but I've created a processing library that can pixelate both png and jpg images. Library exports and runs a cfdg file (CF3) to to produce and display the pixelated image. OK perhaps there is a point, cfdg can produce high resolution images at almost any scale (that makes sense). Here is an example, I've posted the library on github:-
import pde2cfdg.*;

 * Two cfdg files are written to the sketch folder one for design one for data,
 * this means it easier to edit the design (eg to replace CIRCLE with a custom shape)
 * The output png file is written to the sketch folder,

ProcessingToCF cfdg;
int dotSize = 3;
void setup() {
  size(1280, 1024);
  colorMode(HSB, 1.0);
  cfdg = new ProcessingToCF(this);

void draw() {
  if (cfdg.finished()) {            
    PImage img = loadImage(cfdg.outFile);
    image(img, 0, 0, img.width, img.height);
    // background(img); // preferred but blows up if output image isn't the correct size
    // noLoop();

void keyReleased() {
  switch(key) {
  case 'r':
  case '1':
  case '2':
  case '3':
  case '4':
  case '5':
  case '6':
    dotSize = key - 48;
I can confirm I own copyright to this and the original image which is a photo of a cross for mariners at Freshwater West beach, Pembrokeshire. The library is loosely based on this idea by guigui.

No comments:

Post a Comment


Blog Archive

About Me

My photo
Pembrokeshire, United Kingdom
I have developed JRubyArt and propane new versions of ruby-processing for JRuby- and processing-3.2.2