Created
March 4, 2013 12:00
-
-
Save dahlia/5081821 to your computer and use it in GitHub Desktop.
Wand experiments with PixelGet{Red,Green,Blue,Alpha}Quantum() functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ctypes | |
from wand.api import library | |
from wand.color import Color | |
library.PixelGetRedQuantum.argtypes = [ctypes.c_void_p] | |
library.PixelGetRedQuantum.restype = ctypes.c_size_t | |
library.PixelGetGreenQuantum.argtypes = [ctypes.c_void_p] | |
library.PixelGetGreenQuantum.restype = ctypes.c_size_t | |
library.PixelGetBlueQuantum.argtypes = [ctypes.c_void_p] | |
library.PixelGetBlueQuantum.restype = ctypes.c_size_t | |
library.PixelGetAlphaQuantum.argtypes = [ctypes.c_void_p] | |
library.PixelGetAlphaQuantum.restype = ctypes.c_size_t | |
with Color('#ff0088') as c: | |
print (c.red, c.green, c.blue, c.alpha) | |
# Prints: (1.0, 0.0, 0.5333333333333333, 1.0) | |
print ( | |
library.PixelGetRedQuantum(c.resource), | |
library.PixelGetGreenQuantum(c.resource), | |
library.PixelGetBlueQuantum(c.resource), | |
library.PixelGetAlphaQuantum(c.resource), | |
) | |
# Prints: (65535L, 0L, 34952L, 65535L) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@inactivist Thanks for your surveys.