コード例 #1
0
ファイル: test_core.py プロジェクト: wxmann/satellite-stitch
def test_sidebyside_right_img_larger():
    im1 = open_image('imgs/baseimg.jpg')
    im2 = open_image('imgs/anotherimg.jpg')
    result = side_by_side(im1, im2, 'RGB')
    expected = open_image('imgs/happypath_sidebyside_result.jpg')

    return result, expected
コード例 #2
0
ファイル: test_core.py プロジェクト: wxmann/satellite-stitch
def test_overlay_bottom_right():
    im = open_image('imgs/baseimg.jpg')
    wm = open_image('imgs/copyright-small.png')
    result = overlay(im, wm, pos=(im.width - wm.width, im.height - wm.height))
    expected = open_image('imgs/bottomright_overlay_result.jpg')

    return result, expected
コード例 #3
0
ファイル: test_core.py プロジェクト: wxmann/satellite-stitch
def test_sidebyside_top_align():
    im1 = open_image('imgs/anotherimg.jpg')
    im2 = open_image('imgs/baseimg.jpg')
    result = side_by_side(im1, im2, 'RGB', valign='top')
    expected = open_image('imgs/valign_top_sidebyside_result.jpg')

    return result, expected
コード例 #4
0
ファイル: test_core.py プロジェクト: wxmann/satellite-stitch
def test_sidebyside_left_img_smaller():
    im1 = open_image('imgs/anotherimg.jpg')
    im2 = open_image('imgs/baseimg.jpg')
    result = side_by_side(im1, im2, 'RGB')
    expected = open_image('imgs/smallerleft_sidebyside_result.jpg')

    return result, expected
コード例 #5
0
ファイル: test_core.py プロジェクト: wxmann/satellite-stitch
def test_stack_top_img_larger():
    im1 = open_image('imgs/baseimg.jpg')
    im2 = open_image('imgs/anotherimg.jpg')
    result = stack(im1, im2, 'RGB', halign='left')
    expected = open_image('imgs/halign_left_stack_result.jpg')

    return result, expected
コード例 #6
0
ファイル: test_core.py プロジェクト: wxmann/satellite-stitch
def test_stack_halign_center():
    im1 = open_image('imgs/baseimg.jpg')
    im2 = open_image('imgs/anotherimg.jpg')
    result = stack(im1, im2, 'RGB', halign='center')
    expected = open_image('imgs/halign_center_stack_result.jpg')

    return result, expected
コード例 #7
0
ファイル: test_core.py プロジェクト: wxmann/satellite-stitch
def test_stack_halign_right_bottom_img_larger():
    im1 = open_image('imgs/anotherimg.jpg')
    im2 = open_image('imgs/baseimg.jpg')
    result = stack(im1, im2, 'RGB', halign='right')
    expected = open_image('imgs/halign_right_bottom_larger_stack_result.jpg')

    return result, expected
コード例 #8
0
ファイル: test_core.py プロジェクト: wxmann/satellite-stitch
def test_overlay_top_left():
    im = open_image('imgs/baseimg.jpg')
    wm = open_image('imgs/copyright-small.png')
    result = overlay(im, wm)
    expected = open_image('imgs/happypath_overlay_result.jpg')

    return result, expected
コード例 #9
0
def test_multiple_edits():
    im = NICTPostProcessor(open_image('imgs/baseimg.jpg'),
                           datetime(2017, 8, 6, 0, 0))
    im.crop_relative(0.5, 0.25, 1.0, 0.9)
    im.apply_filter(ImageFilter.SHARPEN)
    im.timestamp_label()
    im.logo()
    return im.result(), open_image('imgs/baseimg_multiple_edits.jpg')
コード例 #10
0
ファイル: test_core.py プロジェクト: wxmann/satellite-stitch
def test_both_stack_and_side_by_side():
    im1 = open_image('imgs/baseimg.jpg')
    im2 = open_image('imgs/anotherimg.jpg')
    result1 = stack(im1, im2, 'RGB', halign='center')
    result_final = side_by_side(result1, im2, 'RGB', valign='top')
    expected = open_image('imgs/stack_and_side_by_side.jpg')

    return result_final, expected
コード例 #11
0
def test_minimize():
    im = PostProcessor(open_image('imgs/baseimg.jpg'), datetime.utcnow())
    im.minimize(500, 500)

    result = im.result()
    assert result.width == 500
    assert result.height == int(im.original.height * 500 / im.original.width)
コード例 #12
0
def test_crop_relative():
    im = PostProcessor(open_image('imgs/baseimg.jpg'), datetime.utcnow())
    im.crop_relative(0.5, 0.25, 1.0, 0.9)
    return im.result(), open_image('imgs/baseimg_cropped.jpg')
コード例 #13
0
def test_add_timestamp_label_custom_params():
    im = PostProcessor(open_image('imgs/baseimg.jpg'),
                       datetime(2017, 8, 6, 0, 0))
    im.timestamp_label(padding=0.2, breadth=0.5)
    return im.result(), open_image('imgs/baseimg_w_timestamp_custom.jpg')
コード例 #14
0
def test_add_timestamp_label_default_params():
    im = PostProcessor(open_image('imgs/baseimg.jpg'),
                       datetime(2017, 8, 6, 0, 0))
    im.timestamp_label()
    return im.result(), open_image('imgs/baseimg_w_timestamp.jpg')
コード例 #15
0
def test_add_timestamp_invalid_params():
    im = PostProcessor(open_image('imgs/baseimg.jpg'),
                       datetime(2017, 8, 6, 0, 0))
    with pytest.raises(ValueError):
        im.timestamp_label(padding=0.5, breadth=1.0)
コード例 #16
0
ファイル: test_core.py プロジェクト: wxmann/satellite-stitch
def test_sidebyside_invalid_align():
    im1 = open_image('imgs/anotherimg.jpg')
    im2 = open_image('imgs/baseimg.jpg')
    with pytest.raises(ValueError):
        side_by_side(im1, im2, 'RGB', valign='invalid-argument')
コード例 #17
0
def test_add_sharpen_filter():
    im = PostProcessor(open_image('imgs/baseimg.jpg'), datetime.utcnow())
    im.apply_filter(ImageFilter.SHARPEN)
    return im.result(), open_image('imgs/baseimg_sharpened.jpg')
コード例 #18
0
def test_add_cira_rammb_logo_big():
    im = CIRAPostProcessor(open_image('imgs/baseimg.jpg'), 'dummy_product',
                           datetime.utcnow())
    im.logo(breadth=0.5)
    return im.result(), open_image('imgs/baseimg_ciralogo_big.jpg')
コード例 #19
0
def test_add_colorbar():
    im = CIRAPostProcessor(open_image('imgs/baseimg.jpg'), 'band_14',
                           datetime.utcnow())
    im.colorbar()
    return im.result(), open_image('imgs/baseimg_colorbar.jpg')
コード例 #20
0
def test_add_nict_logo():
    im = NICTPostProcessor(open_image('imgs/baseimg.jpg'), datetime.utcnow())
    im.logo()
    return im.result(), open_image('imgs/baseimg_nictlogo.jpg')
コード例 #21
0
def test_crop_relative_improper_params():
    im = PostProcessor(open_image('imgs/baseimg.jpg'), datetime.utcnow())
    with pytest.raises(ValueError):
        im.crop_relative(0.5, 0.25, 1.25, 0.9)