New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added image.type property (mainly useful for format conversion) #33

Merged
merged 1 commit into from Aug 22, 2012

Conversation

4 participants
@ewiger

ewiger commented Aug 13, 2012

  • Added signature for the MagickGetImageType

modified: wand/image.py

  • Exposed more tuples in all defining low-level types.

  • Implemented image.type() property, .e.g

    if img.type == 'grayscale':
    img.type = 'grayscalematte'
    assert img.type == 'grayscalematte'

Yauhen Yakimovich
modified: wand/api.py
- Added signature for the MagickGetImageType

modified:   wand/image.py
- Exposed more tuples in _all_ defining low-level types.
- Implemented image.type() property, .e.g

    if img.type == 'grayscale':
        img.type = 'grayscalematte'
    assert img.type == 'grayscalematte'
@travisbot

This comment has been minimized.

travisbot commented Aug 13, 2012

This pull request passes (merged 9343398 into 2b2370d).

@@ -21,7 +21,8 @@
from .resource import DestroyedResourceError, Resource
__all__ = 'FILTER_TYPES', 'Image', 'Iterator', 'ClosedImageError'
__all__ = 'FILTER_TYPES', 'COMPOSITE_OPS', 'CHANNELS', 'EVALUATE_OPS',\
'IMAGE_TYPES', 'Image', 'Iterator', 'ClosedImageError'

This comment has been minimized.

@dahlia

dahlia Aug 13, 2012

Collaborator

Where are those constants (COMPOSITE_OPS, CHANNELS, EVALUATE_OPS, IMAGE_TYPES) defined?

This comment has been minimized.

@ewiger

ewiger Aug 13, 2012

see wand.image before first class

raise TypeError("Type value must be a string from IMAGE_TYPES"
', not ' + repr(image_type))
library.MagickSetImageType(
self.wand, IMAGE_TYPES.index(image_type))

This comment has been minimized.

@dahlia

dahlia Aug 13, 2012

Collaborator

Aren’t there any possibilities that it fails? If then, it should raise a proper error.

This comment has been minimized.

@pflorczyk

pflorczyk Aug 20, 2012

Contributor

It can fail in multiple ways. In type setter, after library call it should check if there are any exceptions by calling self.raise_exception().
If you commit this I will try to fix that and write basic tests (Image.alpha_channel property affects Image.type).

@dahlia

This comment has been minimized.

Collaborator

dahlia commented Aug 13, 2012

Can you write some tests for this property?

@dahlia dahlia merged commit 9343398 into emcconville:master Aug 22, 2012

1 check passed

default The Travis build passed
Details

dahlia added a commit that referenced this pull request Aug 22, 2012

dahlia added a commit that referenced this pull request Aug 22, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment