Implemented image compression method. TO DO: send to server