How to save/map uploaded image in term field of type image with storage location equals s3://
An Image type field should contain a file fid of an image file. The following should resolve your issue:

$img = $form_state-&gt;getValue('image_dir');

if (!empty($img['fids'])) {
  $img = reset($img['fids']);
}