from utils import *

def crop(state, block):

    img = state['image']


    c_h = block.slider('Horizontally', min_value=0, max_value=img.shape[0] // 2, value=0)
    c_v = block.slider('Vertically', min_value=0, max_value=img.shape[1] // 2, value=0)

    x1 = c_v
    x2 = img.shape[0] - c_v
    y1 = c_h
    y2 = img.shape[1] - c_h

    state['image'] = img[ x1 : x2 , y1 : y2 ]