If you have a design you're proud of, share the cfdg file here. It's also a good place to ask for feedback and collaborate.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
User avatar
Posts: 50
Joined: Sat Aug 05, 2006 5:28 pm
Location: Annecy, France


Post by Guigui »

XpoPen ask me to post a Processing script I made to creat a CF rule from the analysis of an image. Used for
Capitaine Archibald Haddock. Doing things with Processig is still a laborious work for me because I'm a newbe in javascript.

In this script, the integers distance is the distance between the analyzed points; the integers zoom is the scale (not zoom, stupid I am) factor for the image from Processing (it's not used in the CF rule). and of course the loadImage("guigui.png") has to be changed in accordance with the image you want to use.

This script is not "strong" and may go crasy, especially if the width of the image is not a multiple of the integer distance.

The result is an image directly made by Processing (for testing) and a file created in your Processing project directory, called "CFpoint.txt".Inside there is a rule called POINTILLISME wich use a rule CIR. The idea is to play in CF with the rule CIR.

But, he he, it's not the end. As I didn't succed to have floating-point numbers with a dot instead of a comma for the decimal point, the comma has to be search an replace in a text editor (or in CF directly)(Btw, if someone has an idea to include such manipulation dirctly in the Processing script ;^) ).

Voilà, here is the script:

* Pointillisme
* par Guigui
* chaque point est à 100% lumineux
* (B à donf sur le HSB)
* la luminosité influe sur la taille des points
* 29/10/2007

PImage imageSource;
int distance = 3;
int zoom = 7;

void setup()
colorMode(HSB, 100);
imageSource = loadImage("guigui.png");

void draw()
String[] CIRCLE = new String[(imageSource.width/distance)*(imageSource.height/distance)+2];
CIRCLE[0] = "startshape POINTILLISME\nbackground {b -1}\n//----------------------------------\n//par Guigui, avec processing…\n//----------------------------------\nrule CIR{CIRCLE{}}\n//----------------------------------\n\nrule POINTILLISME {";

for (int x = 0; x < imageSource.width; x = x+distance) {
for (int y = 0; y < imageSource.height; y = y+distance) {
color pix = imageSource.get(x, y);
float sat = saturation(pix);
float hu = hue(pix);
float taille = brightness(pix)/100*distance;
fill(hu, sat, 100);
ellipse(x*zoom, y*zoom, taille*zoom, taille*zoom);

CIRCLE[(x/distance)+(y/distance*imageSource.width/distance)+1]= "CIR{x "+nf(x,3)+" y "+nf(-y,3)+" s "+nf(taille,1,8)+" hue "+nf(hu*3.6,3,8)+" sat "+nf(sat/100,1,8)+" b 1}";
CIRCLE[(imageSource.width/distance)*(imageSource.height/distance)+1] = "}";

User avatar
Posts: 12
Joined: Thu Nov 02, 2006 11:12 am

More Processing

Post by TheRandomDude »

If I knew how to bring in class files into Processing for the library CFDG uses, I might be interested in attempting to help out with a library file for Processing. It would be great to have something easy to generate individual specific images within a fun GUI

User avatar
Posts: 13
Joined: Fri Jul 03, 2009 10:40 pm
Location: Pembrokeshire, UK


Post by Monkstone »

I've just created a library for processing, loosely based on the code by guigui see my blog http://martinpblogformasswritingproject ... -cfdg.html. I've made the library available via github CF code is updated for CF3, but I'm not super happy about it though. On my linux box processing calls cfdg, and displays final image in the processing ide.

Post Reply