calesthio/OpenMontage · error · ValueError

image is unreadable or corrupt: {source}

Error message

image is unreadable or corrupt: {source}

What it means

Error "image is unreadable or corrupt: {source}" thrown in calesthio/OpenMontage.

Source

Thrown at tools/video/seedance_ark.py:1063

            self._validate_local_image(path)
        elif label == "audio":
            self._probe_local_audio_duration(path)
        encoded = base64.b64encode(path.read_bytes()).decode("ascii")
        return f"data:{mime};base64,{encoded}"

    def _validate_local_image(self, path: Path) -> None:
        self._validate_image_bytes(path.read_bytes(), str(path))

    @staticmethod
    def _validate_image_bytes(data: bytes, source: str) -> None:
        try:
            from PIL import Image

            with Image.open(io.BytesIO(data)) as image:
                width, height = image.size
                image.verify()
        except Exception as exc:
            raise ValueError(f"image is unreadable or corrupt: {source}") from exc
        if not (300 <= width <= 6000 and 300 <= height <= 6000):
            raise ValueError(
                "local image width and height must each be 300 to 6000 pixels"
            )
        ratio = width / height
        if not 0.4 <= ratio <= 2.5:
            raise ValueError(
                "local image width/height ratio must be between 0.4 and 2.5"
            )

    def _validate_data_uri(
        self,
        value: str,
        *,
        suffix_to_mime: dict[str, str],
        max_bytes: int,
        label: str,
    ) -> str:

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Re-export or re-download the image; the file bytes cannot be decoded.
  2. Verify the source file opens in an image viewer and is not truncated or zero-byte.

When it happens

Trigger: The reference image bytes cannot be decoded, indicating an unreadable or corrupt image file.

Common situations: See trigger scenarios.


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/4cf5c1d306dceddc. Report an issue: GitHub.