Looks like it just needs box-sizing to make the auto width account for the border.
.cooked img:not(.thumbnail, .ytp-thumbnail-image, .emoji), .d-editor-preview img:not(.thumbnail, .ytp-thumbnail-image, .emoji) {
border: 1px solid #000;
box-sizing: border-box;
}