add encodeNamedImage