Encode and decode data from a jpg image