Algorithm coding Photos