import copy


def _create_output_header(header):
    """Create the header of the output file from the input file.

    Keep most metadata, but remove view, multiView and channel information and add comment.
    """
    header = copy.deepcopy(header)
    header['channels'] = {}
    header.pop('view', None)
    header.pop('multiView', None)
    comment = b'Processed by exrsplit'
    prev_comment = header.setdefault('comments', comment)
    if prev_comment is not None and comment not in prev_comment:
        header['comments'] = prev_comment + b' - ' + comment
    return header