There is no need to compute the space needed.
If you pass the address to a pointer that is
NULL pointer as the last parameter of
uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, void **buffer_r) , then it will allocate by itself the required space.
void *buffer = NULL; asn_per_constraints_s *constraints = NULL; ssize_t ec = uper_encode_to_new_buffer(&asn_DEF_Image, constraints, image, &buffer);
This post is also available in: Greek