A method for ECG compression, by imaging the record as a 2D array and implementing a transform lossy compression strategy, is advanced. The particularity of the proposed transformation consists in applying a Discrete Wavelet Transform along one of the dimensions and the Discrete Cosine Transform along the other dimension. This renders a transformed array which is characterized by being sparse. Using the MIT-BIH Arrhythmia database, it is demonstrated that the proposed Mixed Transform achieves, in mean value, an improvement in sparsity of up to 3 times with respect to the 2D Wavelet Transform. This feature is beneficial for compression. The resulting codec produces a mean value compression ratio of 39 for a quality corresponding to PRD= 0.6. This PRD is attained for every record in the database without previous filtering.