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.
Page Index Toggle Pages: 1
how load a .tif? (Read 1163 times)
how load a .tif?
Jul 22nd, 2009, 11:02pm
 
This must be dead easy but I am somehow missing something.

I am creating screen captures with saveFrame. How can I then load these .tif files I have created and then display them?

The idea is to generate the files and then show them afterwards in the same sketch.

Re: how load a .tif?
Reply #1 - Jul 23rd, 2009, 12:57am
 
Have a look at loadImage():

http://processing.org/reference/loadImage_.html
Re: how load a .tif?
Reply #2 - Jul 23rd, 2009, 1:14am
 
if you only want to create images, to show them again, and actually dont need them as saved files.

So depending on what you need and plan to do. maybe PGraphics would be also a good solution :
http://processing.org/reference/PGraphics.html

Re: how load a .tif?
Reply #3 - Jul 23rd, 2009, 1:33am
 
Why are you using the Tiff format? Using Jpeg or PNG, you would have no problems loading them back.
Re: how load a .tif?
Reply #4 - Jul 23rd, 2009, 6:16am
 
well I guess the issue is that saveFrame() only saves in .tif format.

if I use PGraphics I could try making an array of PGGraphic objects (one for each image I need to store).

Re: how load a .tif?
Reply #5 - Jul 23rd, 2009, 6:20am
 
http://processing.org/reference/saveFrame_.html

Syntax        

saveFrame()
saveFrame("filename-####.ext")

Parameters      
filename      String: any sequence of letters and numbers
ext      either "tif", "tga", "jpg", "png"
Re: how load a .tif?
Reply #6 - Jul 23rd, 2009, 7:37am
 
koogy wrote on Jul 23rd, 2009, 6:20am:
http://processing.org/reference/saveFrame_.html

Syntax        

saveFrame()
saveFrame("filename-####.ext")

Parameters      
filename      String: any sequence of letters and numbers
ext      either "tif", "tga", "jpg", "png"


I made the mistake of trying to save as .gif and that is why I was mislead to think I could not to another format. Then when I read the saveFrame documentation (not just the save()) I thought it said .tif only.
My mistake!
Re: how load a .tif?
Reply #7 - Jul 23rd, 2009, 7:39am
 
Ok using loadimage() method is not working since it will only load a single image for a PImage variable and then will not allow me to load a new image into that same variable.

I also tried PGraphics but I was not able to get the camera capture to be drawn into the buffer.

I'll strip the code down to basics and post it here to see if anyone can see some flaws.

thanks for the help so far!
Re: how load a .tif?
Reply #8 - Jul 23rd, 2009, 12:51pm
 
Dont believe thats true. You can change the Image assigned to an PImange, just made a test sketch. by pressing the key, you load another jpg ...

Code:
PImage img1;

void setup(){
size(400,400);
background(255);
img1 = loadImage("1.jpg");
}

void draw(){
background(255);
image(img1,0,0);
}


void keyPressed(){
img1 = loadImage("2.jpg");
}
Re: how load a .tif?
Reply #9 - Jul 24th, 2009, 6:23am
 
The mistake I was making was trying to call loadimage within the same cycle of the draw() loop. I did not realise I needed to allow draw to complete a cycle before it would redraw the screen (or new image loaded) and not attempt to do this within my own loop.
Page Index Toggle Pages: 1