Skip to content

Pasting image is too slow #38879

Closed as not planned
Closed as not planned

Description

@affanali2k3

Description

In opencode when you paste an image it takes around 200ms to read the image and show the image marker in opencode. The time is very noticeable and does not feel like a good experience. This is happening because we are using osascript on mac and powershell on windows which eventually creates a new shell and process and uses the commands to copy image to file then read it. The part where it uses external shell adds about 150ms to the time which is unnecessary because it could be a pre built binary or library which does not have to create shell each time to paste image and will be near instant (like 5ms). Check the video below:

Plugins

none

OpenCode version

1.18.4

Steps to reproduce

  1. Copy an image in your clipboard
  2. Paste in opencode
  3. Observe a 200ms time difference in pasting and image marker showing.

Screenshot and/or share link

I enabled keystroke highlightin in bottom left corner see the button press there and the delay in image marker display

Screen.Recording.2026-07-25.at.11.15.00.PM.mov

Operating System

macOS 26.2

Terminal

Kitty (but this is terminal agnostic)

Activity

  1. affanali2k3 commented on Aug 9, 2026

    @affanali2k3
    ContributorAuthor

    bump

  2. added a commit that references this issue on Aug 31, 2026
    0d21de3
  3. shivankj11 commented on Aug 31, 2026

    @shivankj11

    AppleScript coercion: the clipboard as "PNGf" costs about 200ms per megabyte, so a 12MB screenshot takes 2.5s. Spawning osascript is only 40ms of it on my laptop.

    #46456 reads the pasteboard through the ObjC bridge instead. 2500ms → 167ms at 12MB (no new dependency & behavior unchanged).

    @kommander hi, can you assign this to me and add the bug / perf label?

  4. affanali2k3 commented on Sep 2, 2026

    @affanali2k3
    ContributorAuthor

    This is a great approach too. The main delay is due to OSAscript

  5. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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

Metadata

Metadata

Assignees

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