Function halpha_prep, img, histo_scale=histo_scale, imgsize=imgsize
;   -----------------------------------------------------------------
;   ---------------------------------------------------------

    if (n_elements(imgsize) eq 0) then begin
      imgsize = 150         ; default image size
    endif

    isize = imgsize + 20        ; default output disk-image size
    
    mimg = gbo_mask(img)        ; clean up edges /but introduce 
;                     clipped disks!!!
;   mimg = img
    fit_limb,mimg,x,y,r,pixel=4.0,/quiet    ; fit limb

    x0=fix(x+0.5) & y0=fix(y+0.5) & r0=fix(r+0.5)
    
    neast = x0 - r0 -5
    ndia  = 2*r0
    nsouth= y0 - r0 -5
    
    nimg = mimg(neast:neast+ndia+15, nsouth:nsouth+ndia+5)

;   rebin to specified size:

    rimg = congrid(nimg, isize, isize)

;       compute the mean intensity and scale mean to 160.7
    if (n_elements(histo_scale) ne 0) then begin
      ; decompress fits file
      mmax = hist_scale(rimg)
      rimg = bytscl(rimg, min(rimg), mmax)
    endif else begin
      fit_limb, rimg, xcen, ycen, r0, pixel=1.0, /quiet, /fast

      succuss = get_ciridx(isize, isize, xcen, ycen, r0, inidx=inidx, $
        outidx=outidx)

      Iave = total(rimg(inidx)) / n_elements(inidx)
      Irat = 160.7/Iave
      rimg = rimg * Irat        ; dum rescaling...
    
      print, "average Int: ", Iave
          scale = 1b
      rimg = bytscl(rimg, min=0, max=254)
    endelse

    return, rimg
    end