Trying to compress and image using sum of powers