Displaying images from a folder as they are created, How?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
stingerguy

Displaying images from a folder as they are created, How?

Post by stingerguy »

Hi guys. I have a simulation application that spits out images every couple seconds and I need to render them on the screen as the application spits them out. The problem I have is that the pictures arn't created every 2 seconds or some finite interval; The program needs to perform certain calculations before the image is rendered and written to the file. The interval between image writes may be dynamic, but it is in the order or seconds. In the best case, I would like to detect when the file is created (i can do this within the shell script, ImageMagick need not have this functionality) and display the image in a window immediately after.

My problem is that I'm not sure what the best way to do this would be. When I execute the command "display test1.ppm", the image in indeed displayed, but the program keeps running in the foreground and I am unable to execute "display test2.ppm" until I manually exit the first instance of ImageMagick. Is there anyway around this? to set the renderer to run in the background maybe so I have the shell command prompt available to overwrite the window I want to render the next image in?

I know ImageMagick can handle sequences of images, or slideshows. But from what I understand they require a static delay n between the images, which I can't do. I need to be able to run the "display" command when the shell script detects the image has been created and render it to a specific window.

any suggestions?
jlaragy

Re: Displaying images from a folder as they are created, How?

Post by jlaragy »

You could try something like this...

Code: Select all

display test1.ppm &

kill -9 $!
display test2.ppm &

kill -9 $!
In ksh or sh (not csh) $! varaiable contains the PID of the last background process started.

Jim
stingerguy

Re: Displaying images from a folder as they are created, How?

Post by stingerguy »

Hmm, the system is actually Mac OSX based. I know the default shell is bash, not positive it has the alternatives, but i think it should. Does that variable work under bash aswell? or does bash have its own different variable?

Thanks Jim
Post Reply