A proposal and evaluation of a new data compression algorithm inspired from Run Length Encoding called K-RLE which means RLE with a K-Precision. This increases the ratio compression compared to RLE. In order to improve the compression results with different statistics of data sources an in-network processing technique is introduced in order to save energy. In-network processing techniques allow the reduction of the amount of data to be transmitted. The well known in-network processing technique is data compression and/or data aggregation. Data compression is a process that reduces the amount of data in order to reduce data transmitted and/or decreases transfer time because the size of the data is reduced.