Import and Magick++
Posted: 2010-08-12T10:31:24-07:00
Hi, new here, long time fan of ImageMagick. Linux, C++, ImageMagick well versed.
I recently modified a program that would write AVI files based on synthetic imagery. I did not own the AVI module, so I had to do something else. So, I researched the IM Magick++ API and decided it could do what I needed.
What I need to be able to do is dump a series of PNG files to a subdirectory. I use another to (mplayer) to convert them into an AVI. I have accomplished all of this using the "import" command (system("import -window id filename.png"), then image.read(filename.png), then image.write(newfilename.png)). The second write is to give it a unique filename like image001,png, image002.png, etc. My "make_avi_script" uses mplayer functionality to combine all of them into an AVI.
First question: Is there a way to do import (screen grabbing) without a C++ system call? It would be great if there was some class available for this. I would also like to avoid the write associated with the import so as to keep it all in memory (faster). Oh, that write also requires a read (image.read()) to get it back for renaming before the final write. This making sense?
Second question: Is there a way to go straight to an AVI? (as opposed to storing hundreds of PNGs and then foriming into an AVI)
Thank you!!
Mike
I recently modified a program that would write AVI files based on synthetic imagery. I did not own the AVI module, so I had to do something else. So, I researched the IM Magick++ API and decided it could do what I needed.
What I need to be able to do is dump a series of PNG files to a subdirectory. I use another to (mplayer) to convert them into an AVI. I have accomplished all of this using the "import" command (system("import -window id filename.png"), then image.read(filename.png), then image.write(newfilename.png)). The second write is to give it a unique filename like image001,png, image002.png, etc. My "make_avi_script" uses mplayer functionality to combine all of them into an AVI.
First question: Is there a way to do import (screen grabbing) without a C++ system call? It would be great if there was some class available for this. I would also like to avoid the write associated with the import so as to keep it all in memory (faster). Oh, that write also requires a read (image.read()) to get it back for renaming before the final write. This making sense?
Second question: Is there a way to go straight to an AVI? (as opposed to storing hundreds of PNGs and then foriming into an AVI)
Thank you!!
Mike