Encode image id