{"id":13450067,"url":"https://github.com/uploadcare/pillow-simd","last_synced_at":"2026-01-10T04:03:51.898Z","repository":{"id":23186238,"uuid":"26542499","full_name":"uploadcare/pillow-simd","owner":"uploadcare","description":"The friendly PIL fork","archived":false,"fork":true,"pushed_at":"2024-09-23T19:00:23.000Z","size":205520,"stargazers_count":2154,"open_issues_count":13,"forks_count":85,"subscribers_count":42,"default_branch":"simd/master","last_synced_at":"2024-09-26T00:45:16.559Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://python-pillow.github.io/pillow-perf/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"python-pillow/Pillow","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uploadcare.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.SIMD.rst","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null},"funding":{"tidelift":"pypi/Pillow"}},"created_at":"2014-11-12T15:33:02.000Z","updated_at":"2024-09-24T14:25:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/uploadcare/pillow-simd","commit_stats":null,"previous_names":[],"tags_count":100,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uploadcare%2Fpillow-simd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uploadcare%2Fpillow-simd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uploadcare%2Fpillow-simd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uploadcare%2Fpillow-simd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uploadcare","download_url":"https://codeload.github.com/uploadcare/pillow-simd/tar.gz/refs/heads/simd/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219877435,"owners_count":16554893,"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":[],"created_at":"2024-07-31T07:00:29.212Z","updated_at":"2025-10-07T15:31:34.812Z","avatar_url":"https://github.com/uploadcare.png","language":"Python","funding_links":["https://tidelift.com/funding/github/pypi/Pillow"],"categories":["Python","图像数据与CV","Image processing"],"sub_categories":[],"readme":"# Pillow-SIMD\n\nPillow-SIMD is highly optimized version of [Pillow library][original-docs]\nfor x86 architecture (mainly Intel and AMD CPUs).\n\nPillow-SIMD is \"following\" Pillow which means it is\ndrop-in replacements for Pillow of the same version.\nFor example, `Pillow-SIMD 3.2.0.post3` is a drop-in replacement for\n`Pillow 3.2.0`, and  `Pillow-SIMD 3.3.3.post0` — for `Pillow 3.3.3`.\n\nFor more information on the original Pillow, please refer to:\n[read the documentation][original-docs],\n[check the changelog][original-changelog] and\n[find out how to contribute][original-contribute].\n\n\n## Why SIMD\n\nThere are multiple ways to tweak image processing performance.\nTo name a few, such ways can be: utilizing better algorithms, optimizing existing implementations, \nusing more processing power and/or resources. \nOne of the great examples of using a more efficient algorithm is [replacing][gaussian-blur-changes] \na convolution-based Gaussian blur with a sequential-box one.\n\nSuch examples are rather rare, though. It is also known, that certain processes might be optimized \nby using parallel processing to run the respective routines.\nBut a more practical key to optimizations might be making things work faster \nusing the resources at hand. For instance, SIMD computing might be the case.\n\nSIMD stands for \"single instruction, multiple data\" and its essence is \nin performing the same operation on multiple data points simultaneously \nby using multiple processing elements. \nCommon CPU SIMD instruction sets are MMX, SSE-SSE4, AVX, AVX2, AVX512, NEON.\n\nCurrently, Pillow-SIMD can be [compiled](#installation) with SSE4 (default) or AVX2 support.\n\n\n## Status\n\nPillow-SIMD project is production-ready.\nThe project is supported by Uploadcare, a SAAS for cloud-based image storing and processing.\n\n[![Uploadcare][uploadcare.logo]][uploadcare.com]\n\nIn fact, Uploadcare has been running Pillow-SIMD since 2015.\n\nThe following image operations are currently SIMD-accelerated:\n\n- Resize (convolution-based resampling): SSE4, AVX2\n- Gaussian and box blur: SSE4\n- Alpha composition: SSE4, AVX2\n- RGBA → RGBa (alpha premultiplication): SSE4, AVX2\n- RGBa → RGBA (division by alpha): SSE4, AVX2\n- RGB → L (grayscale): SSE4\n- 3x3 and 5x5 kernel filters: SSE4, AVX2\n- Split and get_channel: SSE4\n\n\n## Benchmarks\n\nTons of tests can be found on the [Pillow Performance][pillow-perf-page] page.\nThere are benchmarks against different versions of Pillow and Pillow-SIMD\nas well as ImageMagick, Skia, OpenCV and IPP.\n\nThe results show that for resizing Pillow is always faster than ImageMagick, \nPillow-SIMD, in turn, is even faster than the original Pillow by the factor of 4-6. \nIn general, Pillow-SIMD with AVX2 is always **16 to 40 times faster** than \nImageMagick and outperforms Skia, the high-speed graphics library used in Chromium.\n\n\n## Why Pillow itself is so fast\n\nNo cheats involved. We've used identical high-quality resize and blur methods for the benchmark. \nOutcomes produced by different libraries are in almost pixel-perfect agreement. \nThe difference in measured rates is only provided with the performance of every involved algorithm. \n\n\n## Why Pillow-SIMD is even faster\n\nBecause of the SIMD computing, of course. But there's more to it: \nheavy loops unrolling, specific instructions, which aren't available for scalar data types.\n\n\n## Why do not contribute SIMD to the original Pillow\n\nWell, it's not that simple. First of all, the original Pillow supports \na large number of architectures, not just x86.\nBut even for x86 platforms, Pillow is often distributed via precompiled binaries.\nIn order for us to integrate SIMD into the precompiled binaries \nwe'd need to execute runtime CPU capabilities checks.\nTo compile the code this way we need to pass the `-mavx2` option to the compiler.\nBut with the option included, a compiler will inject AVX instructions even\nfor SSE functions (i.e. interchange them) since every SSE instruction has its AVX equivalent.\nSo there is no easy way to compile such library, especially with setuptools.\n\n\n## Installation\n\nIf there's a copy of the original Pillow installed, it has to be removed first\nwith `$ pip uninstall -y pillow`.\nPlease install [prerequisites](https://pillow.readthedocs.io/en/stable/installation.html#building-from-source) for your platform.\nThe installation itself is simple just as running `$ pip install pillow-simd`, \nand if you're using SSE4-capable CPU everything should run smoothly.\nIf you'd like to install the AVX2-enabled version, \nyou need to pass the additional flag to a C compiler. \nThe easiest way to do so is to define the `CC` variable during the compilation.\n\n```bash\n$ pip uninstall pillow\n$ CC=\"cc -mavx2\" pip install -U --force-reinstall pillow-simd\n```\n\n\n## Contributing to Pillow-SIMD\n\nPlease be aware that Pillow-SIMD and Pillow are two separate projects.\nPlease submit bugs and improvements not related to SIMD to the [original Pillow][original-issues].\nAll bugfixes to the original Pillow will then be transferred to the next Pillow-SIMD version automatically.\n\n\n  [original-homepage]: https://python-pillow.org/\n  [original-docs]: https://pillow.readthedocs.io/\n  [original-issues]: https://github.com/python-pillow/Pillow/issues/new\n  [original-changelog]: https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst\n  [original-contribute]: https://github.com/python-pillow/Pillow/blob/master/.github/CONTRIBUTING.md\n  [gaussian-blur-changes]: https://pillow.readthedocs.io/en/stable/releasenotes/2.7.0.html#gaussian-blur-and-unsharp-mask\n  [pillow-perf-page]: https://python-pillow.github.io/pillow-perf/\n  [pillow-perf-repo]: https://github.com/python-pillow/pillow-perf\n  [uploadcare.com]: https://uploadcare.com/?utm_source=github\u0026utm_medium=description\u0026utm_campaign=pillow-simd\n  [uploadcare.logo]: https://ucarecdn.com/8eca784b-bbe5-4f7e-8cdf-98d75aab8cec/logotransparent.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuploadcare%2Fpillow-simd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuploadcare%2Fpillow-simd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuploadcare%2Fpillow-simd/lists"}