A data compression system has been developed by combining adaptive wavelets and optimization technique. The adaptive wavelets were made by optimizing the coefficients of the wavelet matrix. The optimization procedure has been performed by criteria of minimizing the reconstruction error. The resulting adaptive basis outperformed such conventional basis as Daubechies-5 by 5 10%. It was also shown that the yarn density profiles could be compressed by over 95% without a significant loss of information.