We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › No reference for savePath()
Page Index Toggle Pages: 1
No reference for savePath() (Read 1172 times)
No reference for savePath()
Mar 12th, 2008, 9:32pm
 
Hi. I'm using PImage.save() to save a screenshot. The problem is, I can't seem to just save it to the data folder, or whatever folder I want. I have to put the absolute path.

Now, the program tells me I have to either use createImage() or pass savePath() to save(). However, I can't find the savePath() docs on the reference page, not even in the extended one.

So, how do I use savePath()? Is the reference incomplete or am I just looking in the wrong place?

Thanks!
Re: No reference for savePath()
Reply #1 - Mar 13th, 2008, 5:56pm
 
since save("file.jpg") will put it in the sketch folder, save("data/file.jpg") will put the file into the data folder, so long as you're running as a sketch inside the environment (things will change when you export, that's why it doesn't save to the data folder by default).

savePath() is primarily and internal function so we haven't documented it yet (though you can find it mentioned in the developer documentation on dev.processing.org). it's a useful enough function that it may be worth exposing it in the future.
Re: No reference for savePath()
Reply #2 - Mar 15th, 2008, 6:18am
 
My problem started because save() was not actually saving to my data folder.

I'm doing

Code:

if(fc==(60*3)){
screenExp1=get(round(originX+40),
round(originY+40),
round(height0-80),
round(weight0-80));
screenExp1.save(routeSS1);
println("saved experience 1");
}

because if I do screenExp1.save("test.jpg") I get

"Runtime exception: PImage.save() requieres an absolute
path. Use createImage() or pass savePath() to save"



PS. By the way, I think it would be a good idea if we could copy and paste text from the message area Smiley
Re: No reference for savePath()
Reply #3 - Sep 12th, 2009, 7:39pm
 
I have the same error message as acapulco.  Any idea what is the problem?

import processing.opengl.*;

int increment = 0;

void setup() {
 size(400,400,OPENGL);
 background(255);
 frameRate(10);
}

void draw() {
 rect(60,100,50,50);
 PImage img = createImage(width, height, ARGB);
 img = get(0, 0, 400, 400);
 img.save("rendu_"+increment+".png");
 increment++;
}
Page Index Toggle Pages: 1