Skip to content

Rendering the image from the clipboard #62

@FarazPatankar

Description

@FarazPatankar

Hey y'all, Rust newbie here. For context, I am building a desktop app with Tauri and using arboard to read/write images from/to the clipboard. The writing part works fine but the part I am struggling with is taking the image I read from the clipboard and rendering it on the client so the user can view and edit the image.

Things I've tried in JS:

  • Converting the image.bytes into a blob/base64 string.
  • Rendering the image.bytes into a canvas.

Things I've tried in Rust:

In Rust, the file gets saved by when I open it, I just see this.

I think the issue is probably with my understanding of what image.bytes returns and how to use it to actually convert it into a PNG or any other format that I can use to display the image. I know the image itself is in the form of this ImageData struct but I don't really understand much beyond that.

Could someone help walk me through this or give me some pointers so I can further experiment with implementing this feature within my app?

Additional context: My dev environment is MacOS 12.4 and my frontend is written in React.

Metadata

Metadata

Assignees

No one assigned

    Labels

    supportAsking for help on a clipboard-related subject

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions