def METHOD_NAME(req, job_id=None, size=None):
    job = get_object_or_404(Job, pk=job_id)
    ui = job.user_image
    cal = job.calibration
    tan = cal.raw_tan
    nside,hh = get_healpixes_touching_wcs(tan)
    tt = 'hello %s, job %s, nside %s, hh %s' % (ui, job, nside, hh)
    ver = EnhanceVersion.objects.get(name='v4')
    print('Using', ver)
    EIms = EnhancedImage.objects.filter(version=ver)
    ens = []
    for hp in hh:
        en = EIms.filter(nside=nside, healpix=hp, version=ver)
        if len(en):
            ens.extend(list(en))
    for dnside in range(1, 3):
        if len(ens) == 0:
            bignside = nside / (2**dnside)
            nil,hh = get_healpixes_touching_wcs(tan, nside=bignside)
            tt += 'bigger healpixes: %s: %s' % (bignside, hh)
            for hp in hh:
                en = EIms.filter(nside=bignside, healpix=hp)
                if len(en):
                    ens.extend(list(en))
    tt = tt + ', EnhancedImages: ' + ', '.join('%s'%e for e in ens)
    img = ui.image
    W,H = img.width, img.height
    tt = tt + 'image size %ix%i' % (W,H)
    #return HttpResponse(tt)
    targetwcs = tan.to_tanwcs()
    #print 'Target WCS:', targetwcs
    #print 'W,H', W,H
    logmsg('wcs:', str(targetwcs))
    if size == 'display':
        scale = float(ui.image.get_display_image().width)/ui.image.width
        logmsg('scaling:', scale)
        targetwcs = targetwcs.scale(scale)
        logmsg('scaled wcs:', str(targetwcs))
        H,W = targetwcs.get_height(), targetwcs.get_width()
        img = ui.image.get_display_image()
    print(tt)
    ee = np.zeros((H,W,3), np.float32)
    imgdata = None
    df = img.disk_file
    ft = df.file_type
    fn = df.get_path()
    if 'JPEG' in ft:
        print('Reading', fn)
        I = plt.imread(fn)
        print('Read', I.shape, I.dtype)
        if len(I.shape) == 2:
            I = I[:,:,np.newaxis].repeat(3, axis=2)
        assert(len(I.shape) == 3)
        if I.shape[2] > 3:
            I = I.shape[:,:,:3]
        # vertical FLIP to match WCS
        I = I[::-1,:,:]
        imgdata = I
        mapped = np.zeros_like(imgdata)
    for en in ens:
        logmsg('Resampling %s' % en)
        wcs = en.wcs.to_tanwcs()
        try:
            Yo,Xo,Yi,Xi,nil = resample_with_wcs(targetwcs, wcs, [], 3)
        except OverlapError:
            continue
        #logmsg(len(Yo), 'pixels')
        enI,enW = en.read_files()
        #print 'Cals included in this Enhanced image:'
        #for c in en.cals.all():
        #    print '  ', c
        #logmsg('en:', enI.min(), enI.max())
        if imgdata is not None:
            mask = (enW[Yi,Xi] > 0)
        for b in range(3):
            enI[:,:,b] /= enI[:,:,b].max()
            if imgdata is not None:
                idata = imgdata[Yo[mask],Xo[mask],b]
                DI = np.argsort((idata + np.random.uniform(size=idata.shape))/255.)
                EI = np.argsort(enI[Yi[mask], Xi[mask], b])
                Erank = np.zeros_like(EI)
                Erank[EI] = np.arange(len(Erank))
                mapped[Yo[mask],Xo[mask],b] = idata[DI[Erank]]
            else:
                # Might have to average the coverage here...
                ee[Yo,Xo,b] += enI[Yi,Xi,b]
                # ee[Yo[mask],Xo[mask],b] += enI[Yi[mask],Xi[mask],b]
    tempfn = get_temp_file(suffix='.png')
    if imgdata is not None:
        im = mapped
    else:
        im = np.clip(ee, 0., 1.)
    dpi = 100
    figsize = [x / float(dpi) for x in im.shape[:2][::-1]]
    plt.figure(figsize=figsize, frameon=False, dpi=dpi)
    plt.clf()
    plt.subplots_adjust(left=0, right=1, bottom=0, top=1)
    plt.imshow(im, interpolation='nearest')
    # rdfn = job.get_rdls_file()
    # rd = fits_table(rdfn)
    # ok,x,y = targetwcs.radec2pixelxy(rd.ra, rd.dec)
    # plt.plot(x, y, 'o', mec='r', mfc='none', ms=10)
    plt.savefig(tempfn)
    print('Wrote', tempfn)
    f = open(tempfn, 'rb')
    res = HttpResponse(f)
    res['Content-Type'] = 'image/png'
    return res