-
Notifications
You must be signed in to change notification settings - Fork 199
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
Metadata support #56
Metadata support #56
Conversation
Added dict-like `metadata` property to `Image` class. It allows to iterate metadata properties and get their values.
By the way, it also covers #25 |
Oops, the build has failed. Travis CI recently works strangely. |
@@ -1421,10 +1422,54 @@ def clone(self): | |||
""" | |||
return type(self)(iterator=self) | |||
|
|||
import UserDict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don’t use this now, right? It seems to has to be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O_o Don't know where did it came here from. Removed this unnecessary import.
Hey @huntrax11, here’s what you’ve been looking for. |
Yeah, but it failed on Attest lib installation. It even haven't run the code :-)
|
@@ -460,6 +460,7 @@ def __init__(self, image=None, blob=None, file=None, filename=None, | |||
read = True | |||
if not read: | |||
raise TypeError('invalid argument(s)') | |||
self.metadata = Metadata(self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be documented. You can define an empty attribute at class-level e.g.:
#: (:class:`Metadata`) The metadata mapping of the image. Read only.
metadata = None
Anyway how does it works well, even though there is no 'metadata'
in the __slots__
list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway how does it works well, even though there is no 'metadata' in the slots list?
Yes, but I'l add it's class-level definition, as you wrote before.
Okay, I merged it and it will be included to 0.3.0 release. |
Cool thanks. |
Added dict-like
metadata
property toImage
class. It allows to iterate metadata properties and get their values.At first I wanted to make a normal dict-like object (with setting and deleting metadata header options). But unfortunately ImageMagick doesn't support writing of image properties to file. So it sets and deletes options, but it doesn't save any changes to metadata (even if image is saved to a new file).
Here are some usage examples: