We study the problem of choosing an image based optimal wavelet basis with compact support for image data compression and provide a general algorithm for computing the optimal wavelet basis. We parameterize the mother wavelet and the scaling function of wavelet systems through a set of real coefficients of the relevant quadrature mirror filter (QMF) banks. We further introduce the concept of decomposition entropy as an information measure to describe the distance between a given digital image and its projection into the subspace spanned by the wavelet basis. The optimal basis for the given image is obtained through minimizing this information measure. The resulting subspace is used for image analysis and synthesis. A gradient based optimization algorithm is developed for computing the image based optimal wavelet basis. Experiments show improved compression ratios due to the application of the optimal wavelet basis and demonstrate the potential applications of our methodology in image compression. This method is also useful for constructing efficient wavelet based image coding systems.