当前位置: 首页>>代码示例>>Python>>正文


Python Image.isStringType方法代码示例

本文整理汇总了Python中lib.pil.Image.isStringType方法的典型用法代码示例。如果您正苦于以下问题:Python Image.isStringType方法的具体用法?Python Image.isStringType怎么用?Python Image.isStringType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lib.pil.Image的用法示例。


在下文中一共展示了Image.isStringType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: grabclipboard

# 需要导入模块: from lib.pil import Image [as 别名]
# 或者: from lib.pil.Image import isStringType [as 别名]
def grabclipboard():
	debug = 0 # temporary interface
	data = Image.core.grabclipboard(debug)
	if Image.isStringType(data):
		import BmpImagePlugin, StringIO
		return BmpImagePlugin.DibImageFile(StringIO.StringIO(data))
	return data
开发者ID:TheArchives,项目名称:blockBox,代码行数:9,代码来源:ImageGrab.py

示例2: __init__

# 需要导入模块: from lib.pil import Image [as 别名]
# 或者: from lib.pil.Image import isStringType [as 别名]
	def __init__(self, profile):
		# accepts a string (filename), a file-like object, or a low-level
		# profile object
		if Image.isStringType(profile):
			self._set(core.profile_open(profile), profile)
		elif hasattr(profile, "read"):
			self._set(core.profile_fromstring(profile.read()))
		else:
			self._set(profile) # assume it's already a profile
开发者ID:TheArchives,项目名称:blockBox,代码行数:11,代码来源:ImageCms.py

示例3: _getink

# 需要导入模块: from lib.pil import Image [as 别名]
# 或者: from lib.pil.Image import isStringType [as 别名]
	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
开发者ID:TheArchives,项目名称:blockBox,代码行数:22,代码来源:ImageDraw.py

示例4: setink

# 需要导入模块: from lib.pil import Image [as 别名]
# 或者: from lib.pil.Image import isStringType [as 别名]
	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)
开发者ID:TheArchives,项目名称:blockBox,代码行数:14,代码来源:ImageDraw.py

示例5: __init__

# 需要导入模块: from lib.pil import Image [as 别名]
# 或者: from lib.pil.Image import isStringType [as 别名]
	def __init__(self, im):

		data = None
		colortable = None

		# handle filename, if given instead of image name
		if hasattr(im, "toUtf8"):
			# FIXME - is this really the best way to do this?
			im = unicode(im.toUtf8(), "utf-8")
		if Image.isStringType(im):
			im = Image.open(im)

		if im.mode == "1":
			format = QImage.Format_Mono
		elif im.mode == "L":
			format = QImage.Format_Indexed8
			colortable = []
			for i in range(256):
				colortable.append(rgb(i, i, i))
		elif im.mode == "P":
			format = QImage.Format_Indexed8
			colortable = []
			palette = im.getpalette()
			for i in range(0, len(palette), 3):
				colortable.append(rgb(*palette[i:i+3]))
		elif im.mode == "RGB":
			data = im.tostring("raw", "BGRX")
			format = QImage.Format_RGB32
		elif im.mode == "RGBA":
			try:
				data = im.tostring("raw", "BGRA")
			except SystemError:
				# workaround for earlier versions
				r, g, b, a = im.split()
				im = Image.merge("RGBA", (b, g, r, a))
			format = QImage.Format_ARGB32
		else:
			raise ValueError("unsupported image mode %r" % im.mode)

		# must keep a reference, or Qt will crash!
		self.__data = data or im.tostring()

		QImage.__init__(self, self.__data, im.size[0], im.size[1], format)

		if colortable:
			self.setColorTable(colortable)
开发者ID:TheArchives,项目名称:blockBox,代码行数:48,代码来源:ImageQt.py

示例6: __init__

# 需要导入模块: from lib.pil import Image [as 别名]
# 或者: from lib.pil.Image import isStringType [as 别名]
    def __init__(self, fp=None, filename=None):
        Image.Image.__init__(self)

        self.tile = None
        self.readonly = 1  # until we know better

        self.decoderconfig = ()
        self.decodermaxblock = MAXBLOCK

        if Image.isStringType(fp):
            # filename
            self.fp = open(fp, "rb")
            self.filename = fp
        else:
            # stream
            self.fp = fp
            self.filename = filename

        try:
            self._open()
        except IndexError, v:  # end of data
            if Image.DEBUG > 1:
                traceback.print_exc()
            raise SyntaxError, v
开发者ID:katerberg-zz,项目名称:blockBox,代码行数:26,代码来源:ImageFile.py


注:本文中的lib.pil.Image.isStringType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。