/UnityImageClipboard

A plugin for reading images on clipboard on Windows.

Primary LanguageObjective-CMIT LicenseMIT

UnityImageClipboard

A plugin for reading images on clipboard on Windows.

  • It works in editor and runtime.
  • Read the bitmap of image on clipboard.
  • Get the raw pixel array.

Example

  
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class SceneController : MonoBehaviour
{
    public Image ImageRef;

    void Start()
    {

    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.A))
        {
            if (NativePlugin.HasClipboardImage())
            {
                var texture = NativePlugin.GetClipboardImage();
                ImageRef.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero);
            }
        }
    }
}

unity_clipboard_result

TO DO

  • Windows support
  • macOS support
  • 1, 4, 8, 16bit image support.