Skip to content

read tool: missing HEIC/HEIF image format support #62767

Open

Description

@darbin

Summary

The read tool does not support the HEIC/HEIF image format, which is the default photo format for iPhones and newer macOS devices. This means users cannot view their iPhone photos using OpenCode without manually converting them first. HEIC should be added to the list of supported image formats.

Environment

  • opencode version: 2.2.6
  • OS: Darwin 27.2.0 (darwin arm64)
  • Terminal: Apple_Terminal (xterm-256color)
  • Shell: /bin/zsh
  • Install/channel: latest (npm/br)
  • Active plugins: None found in config

Reproduction

  1. Take or download a photo on iPhone (saved as .heic by default)
  2. Place the .heic file in any directory
  3. Run: read /path/to/photo.heic
  4. Error returned: "Cannot read binary file"

Expected Behavior

HEIC files should be read and displayed like PNG, JPEG, GIF, and WebP — passed directly to the model's vision capabilities.

Actual Behavior

The read tool fails with "Cannot read binary file". HEIC is not in the supported format list documented at https://opencode.ai/v2/docs/attachments/

Additional Context

HEIC (High Efficiency Image Container) is Apple's default photo format and is extremely common. macOS users who take screenshots or photos with iPhones will frequently encounter HEIC files. The format is standardized (ISO/IEC 23008-12) and widely supported.

Workaround: Users must manually convert HEIC to JPEG/PNG using sips (macOS built-in):

sips -s format jpeg --out output.jpg input.heic

Or use a community skill I created at ~/.config/opencode/skills/heic/SKILL.md that instructs the agent to auto-convert HEIC files before reading.

Implementation suggestion: Use a library like libheif (available via npm as libheif or through macOS native APIs) to decode HEIC before passing the image to the model. The conversion should be transparent to the user.

This is a high-impact, low-effort feature that would significantly improve the experience for iPhone/macOS users.

Activity

  1. opencodejr commented on Nov 8, 2026

    @opencodejr
    Contributor

    Thanks for the detailed request, @darbin!

    To restate it: you'd like the read tool (and image attachments) to accept HEIC/HEIF photos by converting them to a format the model accepts, instead of failing with Cannot read binary file.

    This isn't a bug. The read tool currently passes only PNG, JPEG, GIF, WebP and PDF to the model, which matches the documented list. Most providers only accept those image formats, so HEIC would need to be converted first. OpenCode already detects HEIC files but has no conversion step yet. I've marked this as a feature request, and maintainers will consider it.

    Related work:

    Until then, your sips workaround (or the skill you wrote) is a good way to handle iPhone photos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions