PHPackages                             xiebruce/php-get-image-from-clipboard - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. xiebruce/php-get-image-from-clipboard

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

xiebruce/php-get-image-from-clipboard
=====================================

Get image that copied to the clipboard(usually from screenshot) and dump it into jpg/png image file. Support macOS/Windows/Linux(Only test on Ubuntu 18.04.2 LTS).

v0.1(6y ago)8441MITPHPPHP &gt;=7.0

Since Sep 16Pushed 6y ago1 watchersCompare

[ Source](https://github.com/xiebruce/php-get-image-from-clipboard)[ Packagist](https://packagist.org/packages/xiebruce/php-get-image-from-clipboard)[ RSS](/packages/xiebruce-php-get-image-from-clipboard/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

php-get-image-from-clipboard
============================

[](#php-get-image-from-clipboard)

PHP-GetImgFromClipboard is a tool that allows you to get image on the clipboard(usually copy to the clipboard by taking a screenshot or copy from web page) and save it to an image file like jpg or png.

Install
-------

[](#install)

```
composer require xiebruce/php-get-image-from-clipboard
```

Requires
--------

[](#requires)

Actually, php can not get image on the clipboard directly, so this tool is rely on other tools.

### For macOS

[](#for-macos)

For macOS, it relies on [pngpaste](https://github.com/jcsalterego/pngpaste), so you should install pngpaste first:

```
brew install pngpaste

```

### For Windows 10

[](#for-windows-10)

For Windows 10, it's free to use, nothing need to be install.

### For Windows 7

[](#for-windows-7)

For Windows 7, you need to update Powershell. Download Powershell update package "Win7AndW2K8R2-KB3191566-x64.zip" from here: , then update and restart.

Before update, you can check the Powershell version. Click "Start" menu on the bottom right corner, input "powershell" to search, then powershell shows up like this: [![Xnip2019-09-05_14-43-33](https://camo.githubusercontent.com/49f4959449d8b01765c509a4a9a4ade727788ff5f86af09def46fac699df6821/68747470733a2f2f696d672e78696562727563652e746f702f323031392f30392f30352f66326463643836633936643834353936303437393764643133393663656564322e6a7067)](https://camo.githubusercontent.com/49f4959449d8b01765c509a4a9a4ade727788ff5f86af09def46fac699df6821/68747470733a2f2f696d672e78696562727563652e746f702f323031392f30392f30352f66326463643836633936643834353936303437393764643133393663656564322e6a7067)

Click to open it and type this command:

```
$PSVersionTable

```

Now you can see, before update, the Powershell version is 2.0: [![Check Powershell version before update](https://camo.githubusercontent.com/feb41b6199a3389c24bb70e7bb3daf315f56ad4ef595dc3bca1aac32389384d9/68747470733a2f2f696d672e78696562727563652e746f702f323031392f30382f32382f36643338386534316635363362653234613135366338636636313634666162372e6a7067)](https://camo.githubusercontent.com/feb41b6199a3389c24bb70e7bb3daf315f56ad4ef595dc3bca1aac32389384d9/68747470733a2f2f696d672e78696562727563652e746f702f323031392f30382f32382f36643338386534316635363362653234613135366338636636313634666162372e6a7067)

After update, the Powershell version is 5.0: [![Check Powershell version after update](https://camo.githubusercontent.com/49d328c53f525f20bc5d041e266b754620632b72d5a10c055005e3a88a735d96/68747470733a2f2f696d672e78696562727563652e746f702f323031392f30382f32382f39363732383462663766323661633139326538353966666137336665633031362e6a7067)](https://camo.githubusercontent.com/49d328c53f525f20bc5d041e266b754620632b72d5a10c055005e3a88a735d96/68747470733a2f2f696d672e78696562727563652e746f702f323031392f30382f32382f39363732383462663766323661633139326538353966666137336665633031362e6a7067)

### For Linux Desktop

[](#for-linux-desktop)

For Linux Desktop System(e.g. Ubuntu, Manjaro, CentOS etc.) , you need to install `xclip`.

On Ubuntu:

```
apt install xclip
```

I didn't test other Linux distributions, but it should be work as long as you install `xclip`.

Usage
-----

[](#usage)

```
