Skip to main content

pyjpgclipboard

Platform Unit Tests

Actions Status Actions Status Actions Status

Brief

Cross platform clipboard for handling copy/paste jpg in python

This libray is meant to do only one thing and one thing well: copy jpg's to and from the system clipboard.

Install

python -m pip install pyjpgclipboard

Ubuntu/Linux

The ubuntu lib uses xclip

sudo apt-get install xclip

If you are running in a headless display you'll need a dummy x-server running to use xclip. Please install it using this:

export DISPLAY=:0
sudo Xvfb -ac :0 -screen 0 1280x1024x24 > /dev/null 2>&1 &

Api

from pyjpgclipboard import clipboard_dump_jpg, clipboard_load_jpg

clipboard_load_jpg("myfile.jpg") # Clipboard now has jpg image
clipboard_dump_jpg("myfile2.jpg) # Clipboard image contents dumped to disk.

Testing

Make sure that tox is installed on your system and run it at the root directory of this project.

Will pyjpgclipboard support more features?

Probably not. Unless it's really important.

We only support jpg images (and not any other formats or text) because manipulating the system clipboard across different platforms is hard. As of the creation of this repo there really isn't any library that allows users to copy / paste jpegs. There are a lot of libraries that allow cross platform posting of text and binary data. So this library is intended to fill in that gap. Libraries like pyclip should, in the future, use pyjpgclipboard to handle the missing jpg clipboard manipulation.

What motivatated this library?

Selenium webdriver tests has a missing feature of taking an image and pasting it through it's api.

This is a problem if you are running a selenium test and you need to be able to test pasting an image as part of your test suite (hence the motivation to create this library).

Footguns

There is only one system clipboard. So running this library in different threads/processes will result in collisions. It's up to the application running this library to provide any necessary locking mechanism.

Versions

  • 1.0.3: Ubuntu implemented and tested to work on headless display
  • 1.0.2: Now installs on linux. Before it would error. But not all codepaths that include this library will actually use it.
  • 1.0.1: Bug fix
  • 1.0.0: Release.

Release files for pyjpgclipboard 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyjpgclipboard 1.0.3
File Size Uploaded
pyjpgclipboard-1.0.3.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyjpgclipboard 1.0.3
File Interpreter ABI Platform
pyjpgclipboard-1.0.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 11.5 kB

Release files / pyjpgclipboard-1.0.3.tar.gz

Download URL pyjpgclipboard-1.0.3.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5c2ecd5b9cf6ddc9cd86be2209e5958576936d294b5137d817c2f4c7329c003a
BLAKE2b-256 checksum
How to use checksums
5e47a476846f7a1b9a0da51018675f38a9de4ae78d3c4517ff2665b247a08be3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.0

Release files / pyjpgclipboard-1.0.3-py2.py3-none-any.whl

Download URL pyjpgclipboard-1.0.3-py2.py3-none-any.whl
Size 5.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
97ecf9f0766c36ec96f34dfdf088adedf79d63be30b3369df8c144f378fc2166
BLAKE2b-256 checksum
How to use checksums
4543f8cac3331f8649e868f0908af25a0c153b7c55a442103afd0f568723e0c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.0

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page