Re: MagickReadImageFile()

Anthony Thyssen <[email protected]> Sun, 11 Sep 2011 21:43:07 +1000
Newsgroups gmane.comp.video.image-magick.user
Message-ID <20110911214307.0662c97c@kirin>
On Sat, 10 Sep 2011 08:13:25 -0700
da.mihi.sis.bubulae.frustrum.assae.solana.tuberosa.in.modo.gallico.fricta.ac.quassum.lactatum.coagulatum.crassum@imagemagick.org wrote:
| > Is there a way to read every image one after another
| 
| Use an iterator.  Here's a code snippet:
| 
|   /*
|     Read an image.
|   */
|   magick_wand=NewMagickWand();
|   status=MagickReadImage(magick_wand,argv[1]);
|   if (status == MagickFalse)
|     ThrowWandException(magick_wand);
|   /*
|     Turn the images into a thumbnail sequence.
|   */
|   MagickResetIterator(magick_wand);
|   while (MagickNextImage(magick_wand) != MagickFalse)
|     MagickResizeImage(magick_wand,106,80,LanczosFilter,1.0);
|   /*
|     Write the image then destroy it.
|   */
|   status=MagickWriteImages(magick_wand,argv[2],MagickTrue);
|   if (status == MagickFalse)
|     ThrowWandException(magick_wand);
| 

This still reads in ALL the images in the image stream into memory first
the processes each image.  Not appropriate for a 'image stream' that
could be for example a long video sequence.


  Anthony Thyssen ( System Programmer )    <[email protected]>
 --------------------------------------------------------------------------
   "Only a fool argues with his Doctor!" - Group Captain Gilmoore
                            -- Doctor Who, "Remembrance of the Daleks"
 --------------------------------------------------------------------------
   Anthony's Castle     http://www.ict.griffith.edu.au/anthony/