SVG Export Error

Hi all,

i try to export an SVG but i get some kind of error, i have googled about this problem but did not found any solution… does someone know how it might work ?

Much Thanks
Sebastian

import processing.video.*;
import processing.svg.*;
int overAllCounter = 0;

Capture video;
PGraphics pg, bg;

//Arrays for the color RGB Value
int[] red = new int[3];
int[] blue = new int[3];
int[] green = new int[3];

//--------------SetUp------------------------------------------------------//

void setup() {  
  frameRate(30);
  size(595, 842); 
  background(255);


  //Initialize Capture object via Constructor
  video = new Capture(this, 640, 480);  
  video.start();

  //creat Pgraphics 
  pg = createGraphics(595, 842);
  bg = createGraphics(595, 842);
}

//--------------Draw--------------------------------------------------------//
void draw() {
  beginRecord(SVG, "test.svg");

  // get 3 colors from the Webcam feed
  color c1 = video.get(329, 380);
  color c2 = video.get(330, 380);
  color c3 = video.get(331, 380);

  //RedValues 
  //Get Int Value of Red
  int redValue1 = int(red(c1));
  int redValue2 = int(red(c2));
  int redValue3 = int(red(c3));

  //safe redValue in Array
  red[0] = redValue1;
  red[1] = redValue2;
  red[2] = redValue3;

  //BlueValues
  //Get Int Value of Blue
  int blueValue1 = int(blue(c1));
  int blueValue2 = int(blue(c2));
  int blueValue3 = int(blue(c3));

  //safe blueValue
  blue[0] = blueValue1;
  blue[1] = blueValue2;
  blue[2] = blueValue3;

  //GreenValues
  //Get Int Value of Green
  int greenValue1 = int(green(c1));
  int greenValue2 = int(green(c2));
  int greenValue3 = int(green(c3));

  //safe greenvalue
  green[0] = greenValue1;
  green[1] = greenValue2;
  green[2] = greenValue3;

  //calculate Brightness of Pixels and generate a Size based on th ebrightness
  float pixBright1 = (redValue1*0.33 + greenValue1*0.5 + blueValue1*0.16);
  int shapeSize1 = int(pixBright1);

  float pixBright2 = (redValue3*0.33 + greenValue3*0.5 + blueValue3*0.16);
  int shapeSize2 = int(pixBright2);

  //Calculate the avarage color of the pixels
  int avgGreen = (greenValue1 + greenValue2 + greenValue3)/3 ;
  int avgRed = (redValue1 + redValue2 + redValue3)/3 ;
  int avgBlue = (blueValue1 + blueValue2 + blueValue3)/3 ;

  //random range
  int ranRange = 11;

  //Calculate the Shapes and their sizes
  int shapeAmount = 5;

  //Create Shapes
  for (int i = 1; i < shapeAmount; i++) {
    pg.beginDraw();
    pg.noStroke();
    pg.fill(avgRed, avgGreen, avgBlue, 255/shapeAmount*i);
    pg.rect(avgRed*random(ranRange)*i, avgBlue*random(ranRange)*i, shapeSize1, shapeSize2, random(50), random(50), random(50), random(50));
    pg.fill(avgRed, avgGreen, avgBlue, 255/shapeAmount*i);
    pg.ellipse(avgRed*random(ranRange)*i, avgBlue*random(ranRange)*i, shapeSize1, shapeSize1); 

    pg.noFill();
    pg.stroke(avgRed, avgGreen, avgBlue, 255/shapeAmount*i);
    pg.rect(avgRed*random(ranRange)*i, avgBlue*random(ranRange)*i, shapeSize1, shapeSize2, random(50), random(50), random(50), random(50));
    pg.stroke(avgRed, avgGreen, avgBlue, 255/shapeAmount*i);
    pg.ellipse(avgRed*random(ranRange)*i, avgBlue*random(ranRange)*i, shapeSize1, shapeSize1);
    pg.endDraw();
  }

  //Create Background
  bg.beginDraw();
  bg.noStroke();
  bg.fill(255, 1);
  bg.rect(0, 0, 595, 842);
  bg.endDraw();

  //Draw the PGraphics
  image(bg, 0, 0);
  for ( int i = 0; i<shapeAmount; i++) {
    image(pg, 0, 0);
  }

  //Counter for ShapeClear
  if (overAllCounter > 25) {
    pg.beginDraw();
    pg.clear();
    pg.endDraw();
    overAllCounter = 0;
  }
  overAllCounter++;


  delay(60);
  if(mousePressed==true){
    endRecord();
  }
  //TestCam
  /*
  image(video, 0, 0);
   fill(255);
   rect(325,380,5,5);
   rect(330,380,5,5);
   rect(335,380,5,5);
   */
}

//--------------Function-----------------------------------------------------//
// An event for when a new frame is available
void captureEvent(Capture video) {  
  // Read the image from the camera.  
  video.read();
}
1 Like

What is the exact error message?

Does PDE indicate a line where the error happens?