{"id":13572158,"url":"https://github.com/libvips/pyvips","last_synced_at":"2025-04-12T16:33:44.799Z","repository":{"id":33088367,"uuid":"98668614","full_name":"libvips/pyvips","owner":"libvips","description":"python binding for libvips using cffi","archived":false,"fork":false,"pushed_at":"2025-03-13T15:41:57.000Z","size":20748,"stargazers_count":686,"open_issues_count":194,"forks_count":48,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-11T03:09:45.135Z","etag":null,"topics":["image-manipulation","image-processing","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/libvips.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-28T16:39:43.000Z","updated_at":"2025-04-08T06:11:14.000Z","dependencies_parsed_at":"2023-10-01T19:53:06.660Z","dependency_job_id":"63cdbc68-f2cf-401f-afd2-898e060c1924","html_url":"https://github.com/libvips/pyvips","commit_stats":{"total_commits":432,"total_committers":17,"mean_commits":25.41176470588235,"dds":0.1875,"last_synced_commit":"55aaf342eacbeca92f6fee2ecf2da28a6e6a243b"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libvips%2Fpyvips","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libvips%2Fpyvips/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libvips%2Fpyvips/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libvips%2Fpyvips/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libvips","download_url":"https://codeload.github.com/libvips/pyvips/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248596554,"owners_count":21130718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image-manipulation","image-processing","python"],"created_at":"2024-08-01T14:01:15.151Z","updated_at":"2025-04-12T16:33:44.757Z","avatar_url":"https://github.com/libvips.png","language":"Python","readme":"README\n======\n\n.. image:: https://github.com/libvips/pyvips/workflows/CI/badge.svg\n    :alt: Build Status\n    :target: https://github.com/libvips/pyvips/actions\n\nPyPI package:\n\nhttps://pypi.python.org/pypi/pyvips\n\nconda package:\n\nhttps://anaconda.org/conda-forge/pyvips\n\nWe have formatted docs online here:\n\nhttps://libvips.github.io/pyvips/\n\nThis module wraps the libvips image processing library:\n\nhttps://www.libvips.org/\n\nThe libvips docs are also very useful:\n\nhttps://www.libvips.org/API/current/\n\nIf you have the development headers for libvips installed and have a working C\ncompiler, this module will use cffi API mode to try to build a libvips\nbinary extension for your Python.\n\nIf it is unable to build a binary extension, it will use cffi ABI mode\ninstead and only needs the libvips shared library. This takes longer to\nstart up and is typically ~20% slower in execution. You can find out if\nAPI mode is being used with:\n\n.. code-block:: python\n\n    import pyvips\n\n    print(pyvips.API_mode)\n\nThis binding passes the vips test suite cleanly and with no leaks under\npython3 and pypy3 on Windows, macOS and Linux.\n\nHow it works\n------------\n\nPrograms that use ``pyvips`` don't manipulate images directly, instead\nthey create pipelines of image processing operations building on a source\nimage. When the end of the pipe is connected to a destination, the whole\npipeline executes at once, streaming the image in parallel from source to\ndestination a section at a time.\n\nBecause ``pyvips`` is parallel, it's quick, and because it doesn't need to\nkeep entire images in memory, it's light.  For example, the libvips\nspeed and memory use benchmark:\n\nhttps://github.com/libvips/libvips/wiki/Speed-and-memory-use\n\nLoads a large tiff image, shrinks by 10%, sharpens, and saves again. On this\ntest ``pyvips`` is typically 3x faster than ImageMagick and needs 5x less\nmemory.\n\nThere's a handy chapter in the docs explaining how libvips opens files,\nwhich gives some more background.\n\nhttps://www.libvips.org/API/current/How-it-opens-files.html\n\nBinary installation\n-------------------\n\nThe quickest way to start with pyvips is by installing the binary package\nwith:\n\n.. code-block:: shell\n\n    $ pip install \"pyvips[binary]\"\n\nThis installs a self-contained package with the most commonly needed\nlibraries. It should just work on most common platforms, including Linux,\nWindows and macOS, with x64 and ARM CPUs.\n\nIf your platform is unsupported or the pre-built binary is\nunsuitable, you can install libvips separately instead.\n\nLocal installation\n------------------\n\nYou need the libvips shared library on your library search path, version 8.2\nor later, though at least version 8.9 is required for all features to work.\nSee:\n\nhttps://www.libvips.org/install.html\n\nLinux\n^^^^^\n\nPerhaps:\n\n.. code-block:: shell\n\n    $ sudo apt install libvips-dev --no-install-recommends\n    $ pip install pyvips\n\nWith python 3.11 and later, you will need to create a venv first and add\n`path/to/venv` to your `PATH`. Something like:\n\n.. code-block:: shell\n\n    $ python3 -m venv ~/.local\n    $ pip install pyvips\n\nmacOS\n^^^^^\n\nWith Homebrew:\n\n.. code-block:: shell\n\n    $ brew install vips python pkg-config\n    $ pip3 install pyvips\n\nWindows\n^^^^^^^\n\nOn Windows, you can download a pre-compiled binary from the libvips website.\n\nhttps://www.libvips.org/install.html\n\nYou'll need a 64-bit Python. The official one works well.\n\nYou can add ``vips-dev-x.y\\bin`` to your ``PATH``, but this will add a lot of\nextra DLLs to your search path and they might conflict with other programs,\nso it's usually safer to set ``PATH`` in your program.\n\nTo set ``PATH`` from within Python, you need something like this at the\nstart of your program:\n\n.. code-block:: python\n\n    import os\n    vipsbin = r'c:\\vips-dev-8.16\\bin'\n    os.environ['PATH'] = vipsbin + ';' + os.environ['PATH']\n\nFor Python 3.8 and later, you need:\n\n.. code-block:: python\n\n    import os\n    vipsbin = r'c:\\vips-dev-8.16\\bin'\n    add_dll_dir = getattr(os, 'add_dll_directory', None)\n    if callable(add_dll_dir):\n        add_dll_dir(vipsbin)\n    else:\n        os.environ['PATH'] = os.pathsep.join((vipsbin, os.environ['PATH']))\n\nNow when you import pyvips, it should be able to find the DLLs.\n\nConda\n^^^^^\n\nThe Conda package includes a matching libvips binary, so just enter:\n\n.. code-block:: shell\n\n    $ conda install --channel conda-forge pyvips\n\nExample\n-------\n\nThis sample program loads a JPG image, doubles the value of every green pixel,\nsharpens, and then writes the image back to the filesystem again:\n\n.. code-block:: python\n\n    import pyvips\n\n    image = pyvips.Image.new_from_file('some-image.jpg', access='sequential')\n    image *= [1, 2, 1]\n    mask = pyvips.Image.new_from_array([\n        [-1, -1, -1],\n        [-1, 16, -1],\n        [-1, -1, -1],\n    ], scale=8)\n    image = image.conv(mask, precision='integer')\n    image.write_to_file('x.jpg')\n\n\nNotes\n-----\n\nLocal user install:\n\n.. code-block:: shell\n\n    $ pip install pyvips-binary==8.16.0\n    $ pip3 install -e .\n    $ pypy -m pip --user -e .\n\nRun all tests:\n\n.. code-block:: shell\n\n    $ tox\n\nRun test suite:\n\n.. code-block:: shell\n\n    $ pytest\n\nRun a specific test:\n\n.. code-block:: shell\n\n    $ pytest tests/test_saveload.py\n\nRun perf tests:\n\n.. code-block:: shell\n\n   $ cd tests/perf\n   $ ./run.sh\n\nStylecheck:\n\n.. code-block:: shell\n\n    $ flake8\n\nGenerate HTML docs in ``doc/build/html``:\n\n.. code-block:: shell\n\n    $ cd doc; sphinx-build -bhtml . build/html\n\nRegenerate enums:\n\nMake sure you have installed a libvips with all optional packages enabled,\nthen\n\n.. code-block:: shell\n\n    $ cd examples; \\\n      ./gen-enums.py ~/GIT/libvips/build/libvips/Vips-8.0.gir \u003e enums.py\n\nThen check and move `enums.py` into `pyvips/`.\n\nRegenerate autodocs:\n\nMake sure you have installed a libvips with all optional packages enabled,\nthen\n\n.. code-block:: shell\n\n    $ cd doc; \\\n      python3 -c \"import pyvips; pyvips.Operation.generate_sphinx_all()\" \u003e x\n\nAnd copy-paste ``x`` into the obvious place in ``doc/vimage.rst``.\n\nUpdate version number:\n\n.. code-block:: shell\n\n    $ vi pyvips/version.py\n    $ vi doc/conf.py\n\nUpdate pypi package:\n\n.. code-block:: shell\n\n    $ python3 -m build --sdist\n    $ twine upload --repository pyvips dist/*\n    $ git tag -a v2.2.0 -m \"as uploaded to pypi\"\n    $ git push origin v2.2.0\n","funding_links":[],"categories":["资源列表","Python","图像数据与CV","Image Processing","图像处理","Image Processing [🔝](#readme)"],"sub_categories":["图像处理","Drone Frames"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibvips%2Fpyvips","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibvips%2Fpyvips","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibvips%2Fpyvips/lists"}