本文整理汇总了Python中sigal.settings.create_settings函数的典型用法代码示例。如果您正苦于以下问题:Python create_settings函数的具体用法?Python create_settings怎么用?Python create_settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_settings函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_process_video
def test_process_video(tmpdir):
base, ext = os.path.splitext(TEST_VIDEO)
settings = create_settings(video_format='ogv', use_orig=True,
orig_link=True)
process_video(SRCFILE, str(tmpdir), settings)
dstfile = str(tmpdir.join(base + '.ogv'))
assert os.path.realpath(dstfile) == SRCFILE
settings = create_settings(video_format='mjpg')
assert process_video(SRCFILE, str(tmpdir), settings) == Status.FAILURE
settings = create_settings(thumb_video_delay=-1)
assert process_video(SRCFILE, str(tmpdir), settings) == Status.FAILURE
开发者ID:Ev4ngelos,项目名称:sigal,代码行数:14,代码来源:test_video.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):
settings = create_settings(img_size=(200, 200), img_processor="WrongMethod")
generate_image(SRCFILE, dstfile, settings)
开发者ID:kuyan,项目名称:sigal,代码行数:8,代码来源:test_image.py
示例3: 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
示例4: 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
示例5: 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
示例6: 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
示例7: test_process_image
def test_process_image(tmpdir):
"Test the process_image function."
status = process_image('foo.txt', 'none.txt', {})
assert status == Status.FAILURE
settings = create_settings(img_processor='ResizeToFill', make_thumbs=False)
status = process_image(SRCFILE, str(tmpdir), settings)
assert status == Status.SUCCESS
im = Image.open(os.path.join(str(tmpdir), TEST_IMAGE))
assert im.size == settings['img_size']
开发者ID:matze,项目名称:sigal,代码行数:11,代码来源:test_image.py
示例8: test_generate_video_dont_enlarge
def test_generate_video_dont_enlarge(tmpdir, fmt):
"""video dimensions should not be enlarged"""
base, ext = os.path.splitext(TEST_VIDEO)
dstfile = str(tmpdir.join(base + '.' + fmt))
settings = create_settings(video_size=(1000, 1000), video_format=fmt)
generate_video(SRCFILE, dstfile, settings,
options=settings.get(fmt + '_options'))
size_src = video_size(SRCFILE)
size_dst = video_size(dstfile)
assert size_src == size_dst
开发者ID:Ev4ngelos,项目名称:sigal,代码行数:12,代码来源:test_video.py
示例9: test_generate_video_dont_enlarge
def test_generate_video_dont_enlarge(tmpdir):
"""video dimensions should not be enlarged"""
base, ext = os.path.splitext(TEST_VIDEO)
dstfile = str(tmpdir.join(base + '.webm'))
settings = create_settings(video_size=(1000, 1000))
generate_video(SRCFILE, dstfile, settings)
size_src = video_size(SRCFILE)
size_dst = video_size(dstfile)
assert size_src == size_dst
开发者ID:MPavleski,项目名称:sigal,代码行数:12,代码来源:test_video.py
示例10: test_generate_video_fit_width
def test_generate_video_fit_width(tmpdir):
"""largest fitting dimension is width"""
base, ext = os.path.splitext(TEST_VIDEO)
dstfile = str(tmpdir.join(base + '.webm'))
settings = create_settings(video_size=(100, 50))
generate_video(SRCFILE, dstfile, settings)
size_src = video_size(SRCFILE)
size_dst = video_size(dstfile)
assert size_dst[1] == 50
# less than 2% error on ratio
assert abs(size_dst[0]/size_dst[1] - size_src[0]/size_src[1]) < 2e-2
开发者ID:MPavleski,项目名称:sigal,代码行数:14,代码来源:test_video.py
示例11: test_generate_video_fit_height
def test_generate_video_fit_height(tmpdir, fmt):
"""largest fitting dimension is height"""
base, ext = os.path.splitext(TEST_VIDEO)
dstfile = str(tmpdir.join(base + '.' + fmt))
settings = create_settings(video_size=(50, 100), video_format=fmt)
generate_video(SRCFILE, dstfile, settings,
options=settings[fmt + '_options'])
size_src = video_size(SRCFILE)
size_dst = video_size(dstfile)
assert size_dst[0] == 50
# less than 2% error on ratio
assert abs(size_dst[0]/size_dst[1] - size_src[0]/size_src[1]) < 2e-2
开发者ID:Ev4ngelos,项目名称:sigal,代码行数:15,代码来源:test_video.py
示例12: test_exif_gps
def test_exif_gps(tmpdir):
"""Test reading out correct geo tags"""
test_image = "flickr_jerquiaga_2394751088_cc-by-nc.jpg"
src_file = os.path.join(CURRENT_DIR, "sample", "pictures", "dir1", "test1", test_image)
dst_file = str(tmpdir.join(test_image))
settings = create_settings(img_size=(400, 300), copy_exif_data=True)
generate_image(src_file, dst_file, settings)
raw, simple = get_exif_tags(dst_file)
assert "gps" in simple
lat = 35.266666
lon = -117.216666
assert abs(simple["gps"]["lat"] - lat) < 0.0001
assert abs(simple["gps"]["lon"] - lon) < 0.0001
开发者ID:kuyan,项目名称:sigal,代码行数:16,代码来源:test_image.py
示例13: test_exif_copy
def test_exif_copy(tmpdir):
"Test if EXIF data can transfered copied to the resized image."
test_image = "11.jpg"
src_file = os.path.join(CURRENT_DIR, "sample", "pictures", "dir1", "test1", test_image)
dst_file = str(tmpdir.join(test_image))
settings = create_settings(img_size=(300, 400), copy_exif_data=True)
generate_image(src_file, dst_file, settings)
simple = get_exif_tags(get_exif_data(dst_file))
assert simple["iso"] == 50
settings["copy_exif_data"] = False
generate_image(src_file, dst_file, settings)
simple = get_exif_tags(get_exif_data(dst_file))
assert not simple
开发者ID:hiramsoft,项目名称:hp-demo-sigal,代码行数:16,代码来源:test_image.py
示例14: test_exif_copy
def test_exif_copy(tmpdir):
"Test if EXIF data can transfered copied to the resized image."
test_image = '11.jpg'
src_file = os.path.join(CURRENT_DIR, 'sample', 'pictures', 'dir1', 'test1',
test_image)
dst_file = str(tmpdir.join(test_image))
settings = create_settings(img_size=(300, 400), copy_exif_data=True)
generate_image(src_file, dst_file, settings)
simple = get_exif_tags(get_exif_data(dst_file))
assert simple['iso'] == 50
settings['copy_exif_data'] = False
generate_image(src_file, dst_file, settings)
simple = get_exif_tags(get_exif_data(dst_file))
assert not simple
开发者ID:matze,项目名称:sigal,代码行数:17,代码来源:test_image.py
示例15: test_exif_gps
def test_exif_gps(tmpdir):
"""Test reading out correct geo tags"""
test_image = 'flickr_jerquiaga_2394751088_cc-by-nc.jpg'
src_file = os.path.join(CURRENT_DIR, 'sample', 'pictures', 'dir1', 'test1',
test_image)
dst_file = str(tmpdir.join(test_image))
settings = create_settings(img_size=(400, 300), copy_exif_data=True)
generate_image(src_file, dst_file, settings)
simple = get_exif_tags(get_exif_data(dst_file))
assert 'gps' in simple
lat = 34.029167
lon = -116.144167
assert abs(simple['gps']['lat'] - lat) < 0.0001
assert abs(simple['gps']['lon'] - lon) < 0.0001
开发者ID:matze,项目名称:sigal,代码行数:18,代码来源:test_image.py
示例16: test_resize_image_portrait
def test_resize_image_portrait(tmpdir):
"""Test that the area is the same regardless of aspect ratio."""
size = (300, 200)
settings = create_settings(img_size=size)
portrait_image = 'm57_the_ring_nebula-587px.jpg'
portrait_src = os.path.join(CURRENT_DIR, 'sample', 'pictures', 'dir2', portrait_image)
portrait_dst = str(tmpdir.join(portrait_image))
generate_image(portrait_src, portrait_dst, settings)
im = Image.open(portrait_dst)
# In the default mode, PILKit resizes in a way to never make an image
# smaller than either of the lengths, the other is scaled accordingly.
# Hence we test that the shorter side has the smallest length.
assert im.size[0] == 200
landscape_image = 'exo20101028-b-full.jpg'
landscape_src = os.path.join(CURRENT_DIR, 'sample', 'pictures', 'dir2', landscape_image)
landscape_dst = str(tmpdir.join(landscape_image))
generate_image(landscape_src, landscape_dst, settings)
im = Image.open(landscape_dst)
assert im.size[1] == 200
开发者ID:matze,项目名称:sigal,代码行数:24,代码来源:test_image.py
注:本文中的sigal.settings.create_settings函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论