def _getink(self, ink, fill=None): if ink is None and fill is None: if self.fill: fill = self.ink else: ink = self.ink else: if ink is not None: if Image.isStringType(ink): ink = ImageColor.getcolor(ink, self.mode) if self.palette and not Image.isNumberType(ink): ink = self.palette.getcolor(ink) ink = self.draw.draw_ink(ink, self.mode) if fill is not None: if Image.isStringType(fill): fill = ImageColor.getcolor(fill, self.mode) if self.palette and not Image.isNumberType(fill): fill = self.palette.getcolor(fill) fill = self.draw.draw_ink(fill, self.mode) return ink, fill
def setink(self, ink): # compatibility if warnings: warnings.warn( "'setink' is deprecated; use keyword arguments instead", DeprecationWarning, stacklevel=2) if Image.isStringType(ink): ink = ImageColor.getcolor(ink, self.mode) if self.palette and not Image.isNumberType(ink): ink = self.palette.getcolor(ink) self.ink = self.draw.draw_ink(ink, self.mode)
def setink(self, ink): # compatibility if warnings: warnings.warn( "'setink' is deprecated; use keyword arguments instead", DeprecationWarning, stacklevel=2 ) if Image.isStringType(ink): ink = ImageColor.getcolor(ink, self.mode) if self.palette and not Image.isNumberType(ink): ink = self.palette.getcolor(ink) self.ink = self.draw.draw_ink(ink, self.mode)
def _color(color, mode): if Image.isStringType(color): from lib.pil import ImageColor color = ImageColor.getcolor(color, mode) return color
def __init__(self, color, file, size=12): # FIXME: add support for bitmap fonts self.color = ImageColor.getrgb(color) self.font = ImageFont.truetype(file, size)
def __init__(self, color, opacity=255): self.color = ImageColor.getrgb(color)
def __init__(self, color, width=1, opacity=255): self.color = ImageColor.getrgb(color) self.width = width
def sepia(white="#fff0c0"): r, g, b = ImageColor.getrgb(white) r = _make_linear_lut(0, r) g = _make_linear_lut(0, g) b = _make_linear_lut(0, b) return ImagePalette("RGB", r + g + b)