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 › update image file when it replaced to a new image
Page Index Toggle Pages: 1
update image file when it replaced to a new image? (Read 940 times)
update image file when it replaced to a new image?
Dec 11th, 2009, 6:42pm
 
Hello.
I'd like to ask if it is possible that the processing detects an image file and reload the image file when the file has replaced to a new image.

Plus,

what would you suggest loading 16 images (each images will be reload with 30 image files in random order, every frame) without using loadImage() on draw();

thanks
Re: update image file when it replaced to a new image?
Reply #1 - Dec 12th, 2009, 2:13am
 
You can use loadImage in draw(), as long as you add the proper logic to avoid loading the image on each frame, only at given frame/time.

First question: you mean you want to check time stamp of a file to see if it have been updated?
Re: update image file when it replaced to a new image?
Reply #2 - Dec 12th, 2009, 4:12pm
 
I have image grid that contains 16images - each images will be loaded on every frame by a randomly chosen image from the database. so using loadImage on draw will give lots of pressure to the memory.
So, without using loadImage on draw()  I'd like to know how the randomizer syntax in setup gives random image to draw() every frame. it is problem to avoid to load nearly 500 images on setup()

This is all about to avoid loadImage on draw(). so I was thinking if there's a way to load a image when the image in the database is changed. (different issue with above randomizer)
Re: update image file when it replaced to a new image?
Reply #3 - Dec 13th, 2009, 1:44pm
 
Once setup() is ran, it won't be run again during the course of the sketch.
If you fear using loadImage() in draw() will stop your sketch (which is probable if you use high framerate and big images), you can use requestImage() to load it in background. But you still have to load it in draw() (or some other event routine).
Page Index Toggle Pages: 1