import imghdr


def is_image(path):
    """Check if the path is an image file"""
    path = str(path)
    try:
        return imghdr.what(path) is not None
    except IsADirectoryError:
        return False