The double-threshold binarization and morphological transform were applied to process the metallographical image. They could classify the grain and the grain boundary from gray metallographical image. Also, the eight-direction tracking techniques about Freeman chain encoding for metal metallographical compression had been discussed, and a grain boundary tracking algorithm was given. The experimental result shows that the proposed image processing method can segment grains and their boundaries efficiently. Freeman chain encoding can compress the stored data of metallographical image greatly. Compared with another compression method RLE, it has much higher compression effect.