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 processing.py

Tuesday, 19 June 2012

Added posterize utility to my pixelation library

I have revised my pixelation library to include a posterize utility. What this does is to convert the image to one with restricted color "channels" using a processing filter. Here is one such sketch (note removal of much cruft from draw() to library, ie hidden).
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);
  background(255);
  colorMode(HSB, 1.0);
  cfdg = new ProcessingToCF(this);
  cfdg.setDotSize(dotSize);
  cfdg.setPathToCFDG("/home/tux/CF3/cfdg");  
  cfdg.posterize(4);  
  cfdg.getInput();
  cfdg.writeCFDG();
}

void draw() {
}

void keyReleased() {
  switch(key) {
  case 'r':
    cfdg.setDotSize(dotSize);
    cfdg.writeCFDG();
    break;
  case '1':
  case '2':
  case '3':
  case '4':
  case '5':
  case '6':
    dotSize = key - 48;
    break;
  }
}
Here is part of the generated cfdg (with a modified dot shape, based on guigui's Captaine Archibald Haddock)
CF::Background = [b -1]

startshape phil_pai

shape dot
  rule 100{dot[r 7]}
  rule 10{dot[s 1.09 1 a -.1]}
  rule 10{dot[s 1.09 1 a -.1]}
  rule {TRIANGLE[]}
  rule {CIRCLE[]}
  rule {SQUARE[]}

import data.cfdg
The artist is my old mate Philip Sutton RA

No comments:

Post a Comment

Followers

Blog Archive

About Me

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