def create_url(parser, config, gmd, id_prefix, num):
    """ Build Library of Congress image resource URL.

    format: {scheme}://{server}{/id_prefix}/{identifier}/{region}/{size}/{rotation}/{quality}.{format}

    Parameters:
        parser (Parser): parser object containing CLI specified and default args
        config (dict): configuration options sourced from YAML file
        gmd (str): general material description(s)
        id_prefix (str): image index id_prefix
        num (str): zfilled image index

    Returns:
        url (str): LOC url
     """

    if parser.format in ('gif', 'jp2', 'tif'):
        return ''.join([
            f"{config['protocol']}",
            f"://{config['subdomain']}",
            f".{config['domain']}",
            f"/{config['service_path'][parser.format]}",
            f"/{gmd.replace(':', '/')}",
            f"/{id_prefix}{num}",
            f".{parser.format}"
            ])
    else:
        return ''.join([
            f"{config['protocol']}",
            f"://{config['subdomain']}",
            f".{config['domain']}",
            f"/{config['service_path'][parser.format]}",
            f":{gmd}",
            f":{id_prefix}{num}",
            f"/{parser.region}",
            f"/pct:{str(parser.size)}",
            f"/{str(parser.rotation_degrees)}",
            f"/{parser.quality}",
            f".{parser.format}"
            ])