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


Python image.generate_image函数代码示例

本文整理汇总了Python中sigal.image.generate_image函数的典型用法代码示例。如果您正苦于以下问题:Python generate_image函数的具体用法?Python generate_image怎么用?Python generate_image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_generate_image

def test_generate_image(tmpdir):
    "Test the generate_image function."

    dstfile = str(tmpdir.join(TEST_IMAGE))
    for size in [(600, 600), (300, 200)]:
        generate_image(SRCFILE, dstfile, size, None, method='ResizeToFill')
        im = Image.open(dstfile)
        assert im.size == size
开发者ID:caelor,项目名称:sigal,代码行数:8,代码来源:test_image.py

示例2: test_generate_image_processor

def test_generate_image_processor(tmpdir):
    "Test generate_image with a wrong processor name."

    init_logging()
    dstfile = str(tmpdir.join(TEST_IMAGE))
    with pytest.raises(SystemExit):
        generate_image(SRCFILE, dstfile, (200, 200), None,
                       method='WrongMethod')
开发者ID:caelor,项目名称:sigal,代码行数:8,代码来源:test_image.py

示例3: test_generate_image_processor

def test_generate_image_processor(tmpdir):
    "Test generate_image with a wrong processor name."

    init_logging()
    dstfile = str(tmpdir.join(TEST_IMAGE))
    with pytest.raises(SystemExit):
        settings = create_settings(img_size=(200, 200), img_processor="WrongMethod")
        generate_image(SRCFILE, dstfile, settings)
开发者ID:kuyan,项目名称:sigal,代码行数:8,代码来源:test_image.py

示例4: test_generate_image_passthrough_symlink

def test_generate_image_passthrough_symlink(tmpdir):
    "Test the generate_image function with use_orig=True and orig_link=True."

    dstfile = str(tmpdir.join(TEST_IMAGE))
    settings = create_settings(use_orig=True, orig_link=True)
    generate_image(SRCFILE, dstfile, settings)
    # Check the file was symlinked
    assert os.path.islink(dstfile)
    assert os.path.samefile(SRCFILE, dstfile)
开发者ID:matze,项目名称:sigal,代码行数:9,代码来源:test_image.py

示例5: test_generate_image

def test_generate_image(tmpdir):
    "Test the generate_image function."

    dstfile = str(tmpdir.join(TEST_IMAGE))
    for size in [(600, 600), (300, 200)]:
        settings = create_settings(img_size=size, img_processor='ResizeToFill')
        generate_image(SRCFILE, dstfile, settings)
        im = Image.open(dstfile)
        assert im.size == size
开发者ID:j0nes2k,项目名称:sigal,代码行数:9,代码来源:test_image.py

示例6: test_generate_image_passthrough

def test_generate_image_passthrough(tmpdir, image, path):
    "Test the generate_image function with use_orig=True."

    dstfile = str(tmpdir.join(image))
    settings = create_settings(use_orig=True)
    generate_image(path, dstfile, settings)
    # Check the file was copied, not (sym)linked
    st_src = os.stat(path)
    st_dst = os.stat(dstfile)
    assert st_src.st_size == st_dst.st_size
    assert not os.path.samestat(st_src, st_dst)
开发者ID:matze,项目名称:sigal,代码行数:11,代码来源:test_image.py

示例7: test_generate_image

def test_generate_image(tmpdir):
    "Test the generate_image function."

    dstfile = str(tmpdir.join(TEST_IMAGE))
    for i, size in enumerate([(600, 600), (300, 200)]):
        settings = create_settings(img_size=size, img_processor='ResizeToFill',
                                   copy_exif_data=True)
        options = None if i == 0 else {'quality': 85}
        generate_image(SRCFILE, dstfile, settings, options=options)
        im = Image.open(dstfile)
        assert im.size == size
开发者ID:matze,项目名称:sigal,代码行数:11,代码来源:test_image.py


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