I am inputting a list of names and output images made as result of list of names. This works fine . It will out put them as tif . But how can I get them output as jpg. and also to a folder in the sketch folder rather than the sketch folder itself. Lines 98 99 100.
//This now adds the rates to the pic;
int[] colorLines;
int[] red;
int[] green;
int[] blue;
int n;
int r1;
int g1;
int b1;
String[] lines;
String l;
void setup(){
size(400,200);}
void draw() {
listOfRates();
noLoop();
}
void listOfRates(){
int[] colorLines = new int [400];
int[] red = new int [400];;
int[] green =new int [400];;
int[] blue =new int [400];
PGraphics pg;
String[] lines = loadStrings("listin.txt");
println("there are " + lines.length + " lines");
for (int i = 0 ; i < lines.length;)
{
String line= lines[i];
String[] linesrates = split(line,' ');
String last = linesrates[linesrates.length-1];
String[] notlast = shorten(linesrates);
String first = join(notlast," ");
println(line);
println(last);
println(first);
pg = createGraphics(400,200);
pg.beginDraw();
// Populate the colorlines with widths .
for( int k=0; k < colorLines.length; k++)
{
strokeCap(SQUARE);
int sW = int(random(20,40));
//strokeWeight(sW);
colorLines[k] = sW;
}
//Make each line.
for( int m = 0; m < 400; m+=16 )
{
// Give each line a random color and width each time it's drawn.
float r = int(random(255));
red[m]=int(r);
float g = int(random(255));
green[m] = int(g);
float b = int(random(255));
blue[m] = int(b);//blue
}
//pg = createGraphics(400,200);
//pg.beginDraw();
for (int j = 0; j < 400; j += 16 )
{
strokeWeight(colorLines[j]);
stroke(red[j],green[j],blue[j]);
line(j, 0, j , 200);
//put input on top of colorcode
}
textSize(26);
fill(255,255,255);
text(first,50,50);
textSize(10);
text("AM", 365, 185);
textSize(14);
text("rate = " + last, 50, 185);
pg.endDraw();
PImage partialSave = get(0,0,400,200);
partialSave.save(line);
println("screenshot saved");
//text("done",10,20);
i++;
}//noLoop();
return;
}