import json


def image_description(shape, colormaped=False, **metadata):
    """Return image description from data shape and meta data.

    Return UTF-8 encoded JSON.

    >>> image_description((256, 256, 3), axes='YXS')  # doctest: +SKIP
    b'{"shape": [256, 256, 3], "axes": "YXS"}'

    """
    if colormaped:
        shape = shape + (3,)
    metadata.update({'shape': shape})
    return json.dumps(metadata).encode('utf-8')