We develop the “ simulated extinction method ” to measure average foreground Galactic extinction from field galaxy number-counts and colors . The method comprises simulating extinction in suitable reference fields by changing the isophotal detection limit . This procedure takes into account selection effects , in particular , the change in isophotal detection limit ( and hence in isophotal magnitude completeness limit ) with extinction , and the galaxy color–magnitude relation . We present a first application of the method to the HST WFPC2 images of the gamma-ray burster GRB 970228 . Four different WFPC2 high-latitude fields , including the HDF , are used as reference to measure the average extinction towards the GRB in the F 606 W passband . From the counts , we derive an average extinction of A _ { V } = 0.5 mag , but the dispersion of 0.4 mag between the estimates from the different reference fields is significantly larger than can be accounted by Poisson plus clustering uncertainties . Although the counts differ , the average colors of the field galaxies agree well . The extinction implied by the average color difference between the GRB field and the reference galaxies is A _ { V } = 0.6 mag , with a dispersion in the estimated extinction from the four reference fields of only 0.1 mag . All our estimates are in good agreement with the value of 0.81 \pm 0.27 mag obtained by Burstein & Heiles , and with the extinction of 0.78 \pm 0.12 measured by Schlegel et al . from maps of dust IR emission . However , the discrepancy between the widely varying counts and the very stable colors in these high-latitude fields is worth investigating .