I’m probably staring at the obvious answer but can’t see it.
Down below id the simple code I’ve put together that reads this simple list and then creates a folder based on the contents of the list, in the folder is another folder which has one file which contains the event date / age group / location as a jpeg. it’s pretty much working as I intend, except it only writes the output image at a size of 100*100. I’ve tried many ways o specify an image size, I’m even loading a starting image of quite a large size.
Please can anyone let me know which bit of code I need to add, and where, so I can make the output as I want?
Here is the input text file…
October 2019
On course
Finish Straight
Yr3-Girls
Yr3-Boys
Yr4-Girls
Yr4-Boys
Yr5-Girls
Yr5-Boys
Yr6-Girls
Yr6-Boys
Yr7-Girls
Yr7-Boys
And here is the code.
PImage img; // Declare variable "a" of type PImage
String entry; // this is used for folder name
String outfile; //this is used for jpeg extension
String eventdate;
String location1;
String location2;
String filepath;
String quotemark = "\"";
String backslash = "/";
PFont f = createFont("Arial",16,true);
PGraphics pg;
String[] lines = loadStrings("textinput");
//println("there are " + lines.length + " lines");
eventdate = lines[0];
location1 = lines [1];
location2 = lines[2];
for (int i = 3 ; i < lines.length; i++) {
entry = lines[i];
outfile = entry + ".jpg";
filepath = "banners";
filepath=filepath + backslash + entry + backslash + outfile;
// println(filepath);
// save(filepath);
// now we have created the file why not open it, add text and save it again
// problem is that everything being saved at 100*100
// repeat the code below for no location eg seniors and 2 locations
img = loadImage("blank2.JPG");
//img = createImage(4000,4000,RGB);
image (img,0,0);
text (eventdate,10,15);
text (entry,10,70);
save (filepath);
//group above got the no location
//now for 'on course'
outfile = entry + "on-course.jpg";
filepath = "banners";
filepath=filepath + backslash + outfile + backslash + outfile;
// println(filepath);
// save(filepath);
// now we have created the file why not open it, add text and save it again
// problem is that everything being saved at 100*100
// repeat below for no location eg seniors and 2 locations
img = loadImage("blank2.JPG");
//img = createImage(4000,4000,RGB);
image (img,0,0);
text (eventdate,10,15);
text (entry,10,50);
text(location1,10,70);
save (filepath);
//now for finishing straight
outfile = entry + "straight.jpg";
filepath = "banners";
filepath=filepath + backslash + outfile + backslash + outfile;
println(filepath);
// save(filepath);
// now we have created the file why not open it, add text and save it again
// problem is that everything being saved at 100*100
// repeat below for no location eg seniors and 2 locations
img = loadImage("blank2.JPG");
//img = createImage(4000,4000,RGB);
image (img,0,0);
text (eventdate,10,15);
text (entry,10,50);
text(location2,10,70);
save (filepath);
}