Quite new to processing so might be overlooking something. I’m trying to export the following as SVG. but it hangs at the for statements. also tried without screen display but that is also not working.
PImage img;
import processing.svg.*;
void setup() {
img = loadImage ("NASA.jpg");
img.filter(GRAY);
img.resize(800, 800);
size(800, 800);
beginRecord(SVG, "planet3.svg");
float tiles = 5;
float tileSize = width/tiles;
translate(tileSize/2, tileSize/2);
//size(800, 800, SVG, "filename.svg");
background(255);
fill(0);
noStroke();
print("123");
for (int x = 0; x <img.width; x++) {
for (int y = 0; y <img.height; y++) {
color c = img.get(int(x*tileSize), int(y*tileSize));
float size = map(brightness(c), 0, 255, tileSize, 0);
ellipse(x*tileSize, y*tileSize, size, size);
}
}
endRecord();
print("test");
//exit();
}
for (int x = 0; x <img.width; x++) {
for (int y = 0; y <img.height; y++) {
color c = img.get(int(x*tileSize), int(y*tileSize));
float size = map(brightness(c), 0, 255, tileSize, 0);
ellipse(x*tileSize, y*tileSize, size, size);
}
}
should be
for (int x = 0; x <tiles; x++) {
for (int y = 0; y <tiles; y++) {
color c = img.get(int(x*tileSize), int(y*tileSize));
float size = map(brightness(c), 0, 255, tileSize, 0);
ellipse(x*tileSize, y*tileSize, size, size);
}
}
when I opened it in illustrator I saw it drew outside the canvas. rendering times seem to be decent now.