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


Python Image.Image方法代码示例

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


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

示例1: expect_crop

# 需要导入模块: import Image [as 别名]
# 或者: from Image import Image [as 别名]
def expect_crop(self, left_x=None, right_x=None, top_y=None, bottom_y=None):
    """Setup a mox expectation to images_stub._Crop."""
    crop_xform = images_service_pb.Transform()
    if left_x is not None:
      if not isinstance(left_x, float):
        raise self.failureException('Crop argument must be a float.')
      crop_xform.set_crop_left_x(left_x)
    if right_x is not None:
      if not isinstance(right_x, float):
        raise self.failureException('Crop argument must be a float.')
      crop_xform.set_crop_right_x(right_x)
    if top_y is not None:
      if not isinstance(top_y, float):
        raise self.failureException('Crop argument must be a float.')
      crop_xform.set_crop_top_y(top_y)
    if bottom_y is not None:
      if not isinstance(bottom_y, float):
        raise self.failureException('Crop argument must be a float.')
      crop_xform.set_crop_bottom_y(bottom_y)
    self._images_stub._Crop(mox.IsA(Image.Image), crop_xform).AndReturn(
        self._image) 
开发者ID:elsigh,项目名称:browserscope,代码行数:23,代码来源:blob_image_test.py

示例2: __init__

# 需要导入模块: import Image [as 别名]
# 或者: from Image import Image [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:awslabs,项目名称:mxnet-lambda,代码行数:26,代码来源:ImageFile.py

示例3: setUp

# 需要导入模块: import Image [as 别名]
# 或者: from Image import Image [as 别名]
def setUp(self):
    self.mox = mox.Mox()
    self._environ = {'PATH_INFO': 'http://test.com/_ah/img/SomeBlobKey',
                     'REQUEST_METHOD': 'GET'}
    self._images_stub = self.mox.CreateMock(images_stub.ImagesServiceStub)
    self._image = Image.Image()
    self.app = blob_image.Application()
    os.environ['APPLICATION_ID'] = 'testapp'
    self._get_images_stub = blob_image._get_images_stub
    blob_image._get_images_stub = lambda: self._images_stub 
开发者ID:elsigh,项目名称:browserscope,代码行数:12,代码来源:blob_image_test.py

示例4: expect_resize

# 需要导入模块: import Image [as 别名]
# 或者: from Image import Image [as 别名]
def expect_resize(self, resize):
    """Setup a mox expectation to images_stub._Resize."""
    resize_xform = images_service_pb.Transform()
    resize_xform.set_width(resize)
    resize_xform.set_height(resize)
    self._images_stub._Resize(mox.IsA(Image.Image),
                              resize_xform).AndReturn(self._image) 
开发者ID:elsigh,项目名称:browserscope,代码行数:9,代码来源:blob_image_test.py

示例5: expect_encode_image

# 需要导入模块: import Image [as 别名]
# 或者: from Image import Image [as 别名]
def expect_encode_image(self, data,
                          mime_type=images_service_pb.OutputSettings.JPEG):
    """Setup a mox expectation to images_stub._EncodeImage."""
    output_settings = images_service_pb.OutputSettings()
    output_settings.set_mime_type(mime_type)
    self._images_stub._EncodeImage(mox.IsA(Image.Image),
                                   output_settings).AndReturn(data) 
开发者ID:elsigh,项目名称:browserscope,代码行数:9,代码来源:blob_image_test.py

示例6: __init__

# 需要导入模块: import Image [as 别名]
# 或者: from Image import Image [as 别名]
def __init__(self, size, interpolation=Image.BILINEAR):
        self.size = size
        self.interpolation = interpolation 
开发者ID:Kashu7100,项目名称:Qualia2.0,代码行数:5,代码来源:transforms.py

示例7: __call__

# 需要导入模块: import Image [as 别名]
# 或者: from Image import Image [as 别名]
def __call__(self, image):
        if isinstance(image, Image.Image):
            image = numpy.asarray(image)
            image = image.transpose(2,0,1)
            image = image.reshape(1,*image.shape) / 255
        elif isinstance(image, np.ndarray):
            image = image / 255
        else:
            raise TypeError
        return Tensor(image) 
开发者ID:Kashu7100,项目名称:Qualia2.0,代码行数:12,代码来源:transforms.py

示例8: main

# 需要导入模块: import Image [as 别名]
# 或者: from Image import Image [as 别名]
def main():
    filename = os.path.join(tempfile.gettempdir(), "image.xpm")
    image = Image.Image(300, 60)
    draw_and_save_image(image, filename)

    filename = os.path.join(tempfile.gettempdir(), "proxy.xpm")
    image = ImageProxy(Image.Image, 300, 60)
    draw_and_save_image(image, filename) 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:10,代码来源:imageproxy1.py

示例9: __init__

# 需要导入模块: import Image [as 别名]
# 或者: from Image import Image [as 别名]
def __init__(self, ImageClass, width=None, height=None, filename=None):
        assert (width is not None and height is not None) or \
                filename is not None
        self.Image = ImageClass
        self.commands = []
        if filename is not None:
            self.load(filename)
        else:
            self.commands = [(self.Image, width, height)] 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:11,代码来源:imageproxy1.py

示例10: load

# 需要导入模块: import Image [as 别名]
# 或者: from Image import Image [as 别名]
def load(self, filename):
        self.commands = [(self.Image, None, None, filename)] 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:4,代码来源:imageproxy1.py

示例11: set_pixel

# 需要导入模块: import Image [as 别名]
# 或者: from Image import Image [as 别名]
def set_pixel(self, x, y, color):
        self.commands.append((self.Image.set_pixel, x, y, color)) 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:4,代码来源:imageproxy1.py

示例12: line

# 需要导入模块: import Image [as 别名]
# 或者: from Image import Image [as 别名]
def line(self, x0, y0, x1, y1, color):
        self.commands.append((self.Image.line, x0, y0, x1, y1, color)) 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:4,代码来源:imageproxy1.py

示例13: ellipse

# 需要导入模块: import Image [as 别名]
# 或者: from Image import Image [as 别名]
def ellipse(self, x0, y0, x1, y1, outline=None, fill=None):
        self.commands.append((self.Image.ellipse, x0, y0, x1, y1,
                outline, fill))

    # Incomplete API. Unsupported are:
    # pixel(), subsample(), scale(), and size() 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:8,代码来源:imageproxy1.py

示例14: __init__

# 需要导入模块: import Image [as 别名]
# 或者: from Image import Image [as 别名]
def __init__(self, ImageClass, width=None, height=None, filename=None):
        assert (width is not None and height is not None) or \
                filename is not None
        self.Image = ImageClass
        self.__image = None
        self.commands = []
        if filename is not None:
            self.load(filename)
        else:
            self.commands = [(self.Image, width, height)] 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:12,代码来源:imageproxy2.py

示例15: load

# 需要导入模块: import Image [as 别名]
# 或者: from Image import Image [as 别名]
def load(self, filename):
        self.__image = None
        self.commands = [(self.Image, None, None, filename)] 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:5,代码来源:imageproxy2.py


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