def create(infile, outfile):
    dprops = capypdf.DocumentProperties()
    pprops = capypdf.PageProperties()
    pprops.set_pagebox(capypdf.PageBox.Media, 0, 0, pagew, pageh)
    dprops.set_default_page_properties(pprops)
    with capypdf.Generator(outfile, dprops) as g:
        ipar = capypdf.ImagePdfProperties()
        ipar.set_mask(True)
        im = g.load_image(infile)
        image_id = g.add_image(im, ipar)
        f4 = capypdf.Type4Function([0, 1],
                                   [0, 1, 0, 1, 0, 1, 0, 1],
                                   function_code)
        f4id = g.add_function(f4)
        sepid = g.add_separation(ink_name, capypdf.DeviceColorspace.CMYK, f4id)
        brown = capypdf.Color()
        brown.set_separation(sepid, 1.0)
        with g.page_draw_context() as ctx:
            with ctx.push_gstate():
                ctx.scale(pagew, pageh)
                ctx.set_nonstroke(brown)
                ctx.cmd_Do(image_id)
