Beispiel #1
0
def test_get_units():
    w = Image()
    assert None == w.units
    api.MagickNewImage(w._wand, 100, 100, api.NewPixelWand())
    assert None == w.units
    api.MagickSetImageUnits(w._wand, api.PixelsPerInchResolution)
    assert PIXELS_PER_INCH == w.units
Beispiel #2
0
def test_get_format():
    w = Image()
    assert None == w.format
    api.MagickNewImage(w._wand, 100, 100, api.NewPixelWand())
    assert None == w.format
    api.MagickSetImageFormat(w._wand, 'PNG')
    assert 'PNG' == w.format
Beispiel #3
0
def test_set_border_color():
    w = setup()
    c = color.PINK
    w.border_color = c
    c2 = api.NewPixelWand()
    api.MagickGetImageBorderColor(w._wand, c2)
    assert api.IsPixelWandSimilar(c2, c._wand, 0)
Beispiel #4
0
    def __init__(self, color=None):
        ''' Create a color.  The specified color can be a name or string
            representation of a color.  Acceptable values can be found in the
            ImageMagick documentation at

                http://www.imagemagick.org/script/color.php.
        '''

        self._wand = api.NewPixelWand()

        if color:
            api.PixelSetColor(self._wand, color)
Beispiel #5
0
def setup():
    i = Image()
    api.MagickNewImage(i._wand, 100, 100, api.NewPixelWand())
    return i
Beispiel #6
0
def test_get_border_color():
    w = setup()
    pw = api.NewPixelWand()
    api.PixelSetColor(pw, 'purple')
    api.MagickSetImageBorderColor(w._wand, pw)
    assert api.IsPixelWandSimilar(pw, w.border_color._wand, 0)