New in version 0.1.2.
Color value.
Unlike any other objects in Wand, its resource management can be implicit when it used outside of with block. In these case, its resource are allocated for every operation which requires a resource and destroyed immediately. Of course it is inefficient when the operations are much, so to avoid it, you should use color objects inside of with block explicitly e.g.:
red_count = 0
with Color('#f00') as red:
with Image(filename='image.png') as img:
for row in img:
for col in row:
if col == red:
red_count += 1
Parameters: | string (basestring) – a color namel string e.g. 'rgb(255, 255, 255)', '#fff', 'white'. see ImageMagick Color Names doc also |
---|
Changed in version 0.3.0: Color objects become hashable.
See also
Equality operator.
Param other: | a color another one |
---|---|
Type color: | Color |
Returns: | True only if two images equal. |
Rtype: | bool |
(numbers.Real) Alpha value, from 0.0 to 1.0.
(numbers.Integral) Alpha value as 8bit integer which is a common style. From 0 to 255.
New in version 0.3.0.
(numbers.Integral) Alpha value. Scale depends on QUANTUM_DEPTH.
New in version 0.3.0.
(numbers.Real) Blue, from 0.0 to 1.0.
(numbers.Integral) Blue as 8bit integer which is a common style. From 0 to 255.
New in version 0.3.0.
(numbers.Integral) Blue. Scale depends on QUANTUM_DEPTH.
New in version 0.3.0.
Raw level version of equality test function for two pixels.
Parameters: |
|
---|---|
Returns: | True only if two pixels equal |
Return type: |
Note
It’s only for internal use. Don’t use it directly. Use == operator of Color instead.
(numbers.Real) Green, from 0.0 to 1.0.
(numbers.Integral) Green as 8bit integer which is a common style. From 0 to 255.
New in version 0.3.0.
(numbers.Integral) Green. Scale depends on QUANTUM_DEPTH.
New in version 0.3.0.
(basestring) The normalized string representation of the color. The same color is always represented to the same string.
New in version 0.3.0.
(numbers.Real) Red, from 0.0 to 1.0.
(numbers.Integral) Red as 8bit integer which is a common style. From 0 to 255.
New in version 0.3.0.
(numbers.Integral) Red. Scale depends on QUANTUM_DEPTH.
New in version 0.3.0.
(basestring) The string representation of the color.
Straightforward port of ScaleQuantumToChar() inline function.
Parameters: | quantum (numbers.Integral) – quantum value |
---|---|
Returns: | 8bit integer of the given quantum value |
Return type: | numbers.Integral |
New in version 0.3.0.