dahlia/wand — pull request #39 by wronglink (2012-08-19 10:00:06+00:00)
Title: Sequences api

A new `Sequence` object is created as `image.sequence` property in `Image` constructor.

Here are some use cases of api:

```python
>>> # Load 4-imaged apple's icon
>>> import requests
>>> r = requests.get('http://apple.com/favicon.ico')
>>> from wand.image import Image
>>> img = Image(blob=r.content, format='ico')
>>> # Get sequenses length
>>> print len(img.sequence)
4
>>> # Print images sizes at sequence
>>> for i in img.sequence:
... print (i, img.size)
...
...
(0L, (32L, 32L))
(1L, (16L, 16L))
(2L, (32L, 32L))
(3L, (16L, 16L))
>>> # Set third image as current (every changes would be applied to it)
>>> img.sequence.index = 2
>>> # Delete all images exept the first one
>>> for i in range(3, 0, -1):
... img.sequence.index = i
... del img.sequence.index
...
...
>>> print len(img.sequence)
1
>>> # Append a copy of our image before current image
>>> img2 = img.clone()
>>> img.sequence.append(img.clone(), True)
>>> print(len(img.sequence))
2
```