A hyperspectral image compression method is proposed using an online dictionary learning approach. The online learning mechanism is aimed at utilizing least number of dictionary elements for each hyperspectral image under consideration. In order to meet this "sparsity constraint", basis pursuit algorithm is used. Hyperspectral imagery from AVIRIS datasets are used for testing purposes. Effects of non-zero dictionary elements on the compression performance are analyzed. Results indicate that, the proposed online dictionary learning algorithm may be utilized for higher data rates, as it performs better in terms of PSNR values, as compared with the state-of-the-art predictive lossy compression schemes.