An Image
type field should contain a file fid
of an image file. Check what do you get in $form_state->getvalues()['image_dir']
.The following should resolve your issue:
$img = $form_state->getValue('image_dir');
if (!empty($img['fids'])) {
$img = reset($img['fids']);
}