def METHOD_NAME(cli):
    # Work out the format
    format = valid_formats[cli.args.format]
    # Create the font object
    font = QFFFont(cli.log)
    # Read from the input file
    cli.args.input = normpath(cli.args.input)
    font.read_from_image(cli.args.input, include_ascii_glyphs=(not cli.args.no_ascii), unicode_glyphs=cli.args.unicode_glyphs)
    # Work out the output directory
    if len(cli.args.output) == 0:
        cli.args.output = cli.args.input.parent
    cli.args.output = normpath(cli.args.output)
    # Render out the data
    out_data = BytesIO()
    font.save_to_qff(format, (False if cli.args.no_rle else True), out_data)
    out_bytes = out_data.getvalue()
    if cli.args.raw:
        raw_file = cli.args.output / (cli.args.input.stem + ".qff")
        with open(raw_file, 'wb') as raw:
            raw.write(out_bytes)
        return
    # Work out the text substitutions for rendering the output data
    subs = {
        'generated_type': 'font',
        'var_prefix': 'font',
        'generator_command': f'qmk painter-convert-font-image -i {cli.args.input.name} -f {cli.args.format}',
        'year': datetime.date.today().strftime("%Y"),
        'input_file': cli.args.input.name,
        'sane_name': re.sub(r"[^a-zA-Z0-9]", "_", cli.args.input.stem),
        'byte_count': len(out_bytes),
        'bytes_lines': render_bytes(out_bytes),
        'format': cli.args.format,
    }
    # Render the license
    subs.update({'license': render_license(subs)})
    # Render and write the header file
    header_text = render_header(subs)
    header_file = cli.args.output / (cli.args.input.stem + ".qff.h")
    with open(header_file, 'w') as header:
        print(f"Writing {header_file}...")
        header.write(header_text)
        header.close()
    # Render and write the source file
    source_text = render_source(subs)
    source_file = cli.args.output / (cli.args.input.stem + ".qff.c")
    with open(source_file, 'w') as source:
        print(f"Writing {source_file}...")
        source.write(source_text)
        source.close()