Vector quantization (VQ) is an effective method of data compression. Its decoding process is very simple and a high compression ratio can be obtained. Thus VQ has been extensively used in image and speech compression. However, VQ has some difficulties such as the efficiency of codebook design process and the degradation of edges. In the codebook design and encoding phases, searching for the closest code word is a highly computational process, especially for high dimensional vectors. Our efforts are to design a fast algorithm to generate a better codebook and to reduce the computation time compared with the previous algorithms in codebook generation. Our algorithm is a top-down algorithm and is based on the longest distance first concept. Some experiments are shown to illustrate that our algorithm is superior to the previous algorithms.