Lightweight Library to Copy PNG and JPG Images to Clipboard

Copy Image Clipboard library allows you to easily copy JPG and PNG (only) images to the clipboard. It can be used with React, Vue, Angular, and other web frameworks. The new browser uses the Clipboard API and has no external dependencies.

how to copy image to clipboard in jquery, copy image to clipboard android, html2canvas copy to clipboard, javascript paste image from clipboard

Most Popular File Extensions and File Types Icons | CSS-file-icons

How to make use of it:

1. Install and download the copy-image-clipboard package.

# Yarn
$ yarn add copy-image-clipboard

$ npm i copy-image-clipboard --save

2. Import the copyImageToClipboard component.

// ES Module
import { copyImageToClipboard } from 'copy-image-clipboard'

// Browser
<script src="index.browser.js"></script>

3. Call the copyImageToClipboard method and specify the path of the image to be copied.

// ES Module
.then(() => {
  console.log('Image Copied')
.catch((e) => {
  console.log('Error: ', e.message)
// Browser
.then(() => {
  console.log('Image Copied')
.catch((e) => {
  console.log('Error: ', e.message)

4. Get the big binary data from the image element.

import {
} from 'copy-image-clipboard'
const imageElement = document.getElementById('image')
.then((blob) => {
  return copyBlobToClipboard(blob)
.then(() => {
  console.log('Blob Copied')
.catch((e) => {
  console.log('Error: ', e.message)

5. Check if an image can be copied to the clipboard.

import { canCopyImagesToClipboard } from 'copy-image-clipboard'
const canCopy = canCopyImagesToClipboard()
console.log('Can Copy Images To Clipboard:', canCopy)

6. Check if the browser has permission Clipboard.write().

import { requestClipboardWritePermission } from 'copy-image-clipboard'
requestClipboardWritePermission().then((hasPermission) => {
  console.log('Has Permission:', hasPermission)

Copy Image To Clipboard Using JavaScript, Copy Image Clipboard Plugin/Github, copy base64 image to clipboard javascript

See Demo And Download

Official Website(LuanEdCosta): Click Here

This superior jQuery/javascript plugin is developed by LuanEdCosta. For extra Advanced usage, please go to the official website.

Related Posts


How to Add Floating Whatsapp Chat Button In HTML | venom-button

Venom Button is a very simple plugin for the jQuery floating WhatsApp button. Adds a floating button to your site that calls WhatsApp Click to Chat API. It will automatically start the WhatsApp…


Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…


Simple Alert, Confirm, Prompt Popup Using Vanilla JavaScript Library | attention.js

JavaScript provides various built-in functionality to display popup messages for different purposes. Attention JS is a vanillaJS plugin used to create a custom alert, confirm, or Prompt…


Bootstrap 4 Sidebar Menu Responsive Template | MDB

Bootstrap Side Navbar – Responsive sidebar template based on the Bootstrap 4 framework. An easy-to-use, totally responsive, Google Material Design impressed aspect navigation for modern web app…


Lightweight Bootstrap 4 Toast Notification Plugin | BS4 Advanced Toast

A lightweight Bootstrap 4 Toast Notification plugin integrated with JS/jQuery. bs4-toast.js is a JavaScript library that enhances the native Bootstrap toast component with icons, buttons, callbacks, and…


How to Create Audio Visualizations with JavaScript | Wave.js

Audio Visualizer Library – wave.js is a vanilla javascript audio visualization library that provides 20+ creative audio visualization effects to bring more engagement to your visitor. Contribute…

Leave a Reply

Your email address will not be published. Required fields are marked *