Skip to content

DOCXKIT_IMAGE_INVALID_DATA: Invalid image data ​

Image content is empty, cannot be identified, or requires a path resolver.

What to do ​

  1. Supply supported non-empty image bytes or a data URL.
  2. For file paths use docx-kit/node; in browsers configure resolveImage.
  3. Check imageType when automatic format detection is unavailable.

Problem example ​

ts
import { createDocx } from 'docx-kit'

await createDocx().image({ data: '' }).toBlob()

Corrected example ​

ts
import { createDocx } from 'docx-kit'

const data = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+aX1cAAAAASUVORK5CYII='
const blob = await createDocx().image({ data }).toBlob()

Common causes ​

  • Empty image data, unsupported format, or an unresolved path.

Diagnostic fields ​

Example message ​

text
Image data is empty or null

Released under the MIT License.