def read_filenames_from_file(pth, input_file, N):
    """
    Read given input_file to gather names of image files. Preprend pth to each filename from
    input_file.

    Returns: fnm, a list of strings representing the full path filename
    """
    with open(input_file) as f:
        fnm = [pth + '/' + x.strip() for x in f.readlines()]
    if N is not None:
        fnm = fnm[0:N]

    return fnm