  The color index $(J-K)_0$ of tip-red giant branch (TRGB) is used to study the
metallicity distribution in the Large and Small Magellanic Cloud. With the most
complete and pure sample of red member stars so far, the areas are divided into
154 and 70 bins for the LMC and SMC respectively with similar number of stars
by the Voronoi binning. For each bin, the position of TRGB on the near-infrared
color-magnitude diagram, specifically $(J-K)_0/K_0$, is determined by the
Poison-Noise weighted method. Converting the color index of TRGB into
metallicity, the metallicity gradients in the LMC and the SMC are obtained in
four major directions. For the LMC, the gradient to the north is $-0.006 \pm
0.004$ dex kpc$^{-1}$, to the south $-0.010 \pm 0.005$ dex kpc$^{-1}$, to the
east $-0.006 \pm 0.003$ dex kpc$^{-1}$, and to the west $-0.010 \pm 0.003$ dex
kpc$^{-1}$. The farthest distance extends to 16 kpc. For the SMC, the gradients
to the north, south, east, and west are $-0.017 \pm 0.031$ dex kpc$^{-1}$,
$-0.016 \pm 0.007$ dex kpc$^{-1}$, $-0.003 \pm 0.002$ dex kpc$^{-1}$, and
$-0.004 \pm 0.003$ dex kpc$^{-1}$, respectively. The farthest distance for the
SMC extends to 27 kpc. The gradient is large from the center to 1 kpc.
