Metallic Ni nanoparticles were embedded in polyimide (PI) films by applying a chemical surface modification technique. The technique consists of a simple alkali treatment of the PI films, an ion exchange reaction, and thermal annealing. The transmission electron microscopic studies showed that the initial alkali treatment time determined the diameter (d) of Ni nanoparticles formed by the annealing at 300°C. With increasing the annealing time, the thickness of the composite layers containing Ni nanoparticles decreased while the d was almost constant. The shrinkage of the composite layer led to a decrease in the spacing (r) among Ni nanoparticles. The d and r can thus be fine-tuned independently. Electron magnetic resonance study clearly indicated that the tuning of d and r enable us to control the magnetic dipolar interaction in the Ni nanoparticle systems. The present technique opens a new way to realize tailor-made nanomagnetic structures.