Trying to use save() to save an image to absolute path folder

hi @Tiemen,
i not think OP uses that
curly quotes

it is just happening ( by the forum topic editor ) when you post code here
“test”
instead inside

</> code tag

"test"


@jeffmarc at first, processing is a project structured IDE
so it supports firstly a relative file read and save.
they wanted to make it very smart so the
read operations use the sketch path AND its sub dir /data/
write can obviously only use one, here the sketchpath

so i recommend following coding

String outfile = "data/test.png";
void setup(){}
void draw(){}
void keyPressed() {
  save(outfile); 
  println("saved to "+outfile);
}

the /data/ dir is created automatically
and please use IDE // File / save as / first

warning: there are libs what do not support that same handling…

to know more about processing settings use this


now for a absolute path,
esp in case you use also WIN 10 & Processing 3.5.3 can use

String outfile = "c:\\Users\\Public\\Pictures\\test.png";

but as @Tiemen tested, also

String outfile = "c:/Users/Public/Pictures/test.png";

works.
please note keyPressed needs a mouseclick on the CANVAS ( get focus ) first.

1 Like