GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Image::Magick::Iterator(3) User Contributed Perl Documentation Image::Magick::Iterator(3)

Image::Magick::Iterator - sequentially read Image::Magick object from a filehandle.

  use strict;
  use Image::Magick::Iterator;

  my $iter = Image::Magick::Iterator->new();

  #assume PPM stream is coming from STDIN;
  $iter->handle(\*STDIN);

  #explicitly set format to PPM, there is no auto-detection built in
  $iter->format('PPM');

  while(my $image = $iter->next){
    print $image->Get('height'),"\n"; #access height attribute of each
                                      #Image::Magick object
  }

Image::Magick::Iterator adds iteration support to Image::Magick. This means that if you have a stream of concatenated images, you can access each image in the stream as an independent Image::Magick object.

Iteration functionality is not present in Image::Magick itself as of version 5.56. Passing a stream of concatenated images would result in essentially a "stack" of images which would all be manipulated in parallel by any Image::Magick calls. Calls to Write() either output an animated series of image (a la animated GIFs), or the first image in the series.

Image::Magick::Iterator is extensible to support many different image filetypes. Currently only PPM support is implemented. See /SYNOPSIS for an example.

Currently only PPM images can be iterated. It's not difficult to add new image types though, and I'm receptive to new classes for handling more formats. To add another format:

1. Have a look at the source of Image::Magick::Iterator::PPM to get an idea of how to write a new format handling class. It is basically a class with one method, read_image, that when given a filehandle reference reads an image from it and passes back the raw data.

2. add a mapping to "_delegate()" that maps the desired value of "format()" to your image reading class.

Email the author.

Allen Day <allenday@ucla.edu>

Copyright (C) 2004 by Allen Day, allenday@ucla.edu

This library is released under GPL, the GNU General Public License

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a '_'. Methods are in alphabetical order for the most part.

Usage
  my $obj = new Image::Magick::Iterator();
    
Function
Builds a new Image::Magick::Iterator object
Returns
an instance of Image::Magick::Iterator
Arguments
None

Usage
  $obj->init(%arg);
    
Function
Internal method to initialize a new Image::Magick::Iterator object
Returns
true on success
Arguments
Arguments passed to "new()"

Usage
  $obj->format();        #get existing value

  $obj->format($newval); #set new value
    
Function
stores a scalar value of the fileformat to be read from "handle()". currently supported formats are:

  * PPM
    
Returns
value of format (a scalar)
Arguments
(optional) on set, a scalar

Usage
  $obj->handle();        #get existing value

  $obj->handle($newval); #set new value
    
Function
stores a filehandle reference (eg \*STDIN, or an IO::Handle.
Returns
value of handle (a scalar)
Arguments
(optional) on set, a scalar

Usage
  $obj->next(); #get next Image::Magick from stream
    
Function
reads an Image::Magick object from a filehandle.
Returns
a Image::Magick object, or undef if the filehandle is EOF or contains only a partial image.
Arguments
none, read-only

Usage
  $obj->_delegate($format);
    
Function
internal method, maps format names to class names
Returns
class to be delegated to for reading an image of the specified format
Arguments
name of an image format

Hey! The above document had some coding errors, which are explained below:
Around line 39:
alternative text '/SYNOPSIS' contains non-escaped | or /
2004-05-06 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.