<?php

use \Drupal\Core\Form\FormStateInterface;

function module_first_form_editor_image_dialog_alter(&$form, FormStateInterface $form_state) {
$image_element = $form_state->get('image_element') ?: [];

$form['attributes']['width'] = [
'#type' => 'textfield',
'#title' => t('Width'),
'#default_value' => isset($image_element['width']) ? $image_element['width'] : '',
];