Skip to main content

pixlib 图像处理工具包

PyPI version Python License Documentation Status

一个轻量级的 Python 图像处理库,专为 AI 图像生成工作流设计。提供纯色图检测、图片有效性校验、透明区域检测、URL 图片下载、MD5 计算、通用 HTTP 请求客户端等实用功能。

主要特性

  • 纯色图检测 (ImageTool.is_plain_gray) - 通过 7 个维度综合判定图片是否为纯色图,支持 bytes / 文件路径 / URL 输入
  • 图片有效性校验 (ImageTool.is_valid_image) - 检测图片是否损坏或不完整,支持 bytes / 文件路径 / URL 输入
  • 透明区域检测 (ImageTool.has_multiple_transparency) - 检测图片是否包含多个透明区域,支持 bytes / 文件路径 / BytesIO / URL 输入
  • 批量透明区域检测 (ImageTool.batch_has_multiple_transparency) - 多线程 + tqdm 进度条批量检测目录下所有图片的透明区域
  • URL 图片下载 (ImageTool.get_img_url_io) - 从 URL 获取图片,支持指数退避重试
  • MD5 计算 (utils.str_to_md5) - 支持字符串、bytes、文件路径
  • 随机字符串 (utils.generate_random_lowercase) - 生成指定长度的随机小写字母
  • HTTP 请求客户端 (HttpRequestClient) - 通用HTTP客户端,支持指数退避重试、GET/POST快捷方法,内置断开ConnectionError重链。

安装

pip install pixlib

使用示例

import pixlib

# 纯色图检测(支持 bytes / 文件路径 / URL)
is_gray, metrics, msg = pixlib.ImageTool.is_plain_gray(image_bytes)
is_gray, metrics, msg = pixlib.ImageTool.is_plain_gray("/path/to/image.png")
is_gray, metrics, msg = pixlib.ImageTool.is_plain_gray("https://example.com/img.png")

# 图片有效性校验(支持 bytes / 文件路径 / URL)
try:
    pixlib.ImageTool.is_valid_image(image_bytes, task_id="abc123")
except Exception as e:
    print(e.extra_data)

# 透明区域检测(支持 bytes / 文件路径 / BytesIO / URL)
has_transparent = pixlib.ImageTool.has_multiple_transparency(image_bytes)

# 批量透明区域检测(多线程 + tqdm 进度条)
results = pixlib.ImageTool.batch_has_multiple_transparency("./images", max_workers=8)
for path, has_trans in results.items():
    if has_trans:
        print(f"有透明区域: {path}")

# URL 下载图片
im_io = pixlib.ImageTool.get_img_url_io("https://example.com/img.png")

# MD5 计算
pixlib.utils.str_to_md5("hello")
pixlib.utils.str_to_md5("/path/to/image.png")

# 随机字符串
pixlib.utils.generate_random_lowercase(10)

# HTTP 请求客户端
client = pixlib.HttpRequestClient(max_retries=3, base_timeout=300)
resp = client.get("https://example.com/api/data")
resp = client.post("https://example.com/api/submit", json={"key": "value"})

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pixlib-1.0.5-cp314-cp314-win_amd64.whl (136.5 kB view details)

Uploaded CPython 3.14Windows x86-64

pixlib-1.0.5-cp314-cp314-manylinux_2_17_x86_64.whl (906.2 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

pixlib-1.0.5-cp313-cp313-win_amd64.whl (133.1 kB view details)

Uploaded CPython 3.13Windows x86-64

pixlib-1.0.5-cp313-cp313-manylinux_2_17_x86_64.whl (916.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pixlib-1.0.5-cp312-cp312-win_amd64.whl (134.6 kB view details)

Uploaded CPython 3.12Windows x86-64

pixlib-1.0.5-cp312-cp312-manylinux_2_17_x86_64.whl (929.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pixlib-1.0.5-cp311-cp311-win_amd64.whl (135.5 kB view details)

Uploaded CPython 3.11Windows x86-64

pixlib-1.0.5-cp311-cp311-manylinux_2_17_x86_64.whl (904.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pixlib-1.0.5-cp310-cp310-win_amd64.whl (136.1 kB view details)

Uploaded CPython 3.10Windows x86-64

pixlib-1.0.5-cp310-cp310-manylinux_2_17_x86_64.whl (865.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pixlib-1.0.5-cp39-cp39-win_amd64.whl (137.2 kB view details)

Uploaded CPython 3.9Windows x86-64

pixlib-1.0.5-cp39-cp39-manylinux_2_17_x86_64.whl (863.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

pixlib-1.0.5-cp38-cp38-win_amd64.whl (140.9 kB view details)

Uploaded CPython 3.8Windows x86-64

pixlib-1.0.5-cp38-cp38-manylinux_2_17_x86_64.whl (893.1 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file pixlib-1.0.5-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: pixlib-1.0.5-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 136.5 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pixlib-1.0.5-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 d84289645cce5fb3630999b32dff41bc9c432d52849dde22b609e79e9c2f37bd
MD5 c7e6e9b655adb2b4b3703a0976e8bf15
BLAKE2b-256 68f73465813e80c73ca6028b8761fac0de57550b3a0158bcdbf3e724392b62ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.5-cp314-cp314-win_amd64.whl:

Publisher: wheels.yml on zhenzi0322-package/pixlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixlib-1.0.5-cp314-cp314-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pixlib-1.0.5-cp314-cp314-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 1aeab138a175e719d8ecddb72a43b97e81914274e1be5fb54ee6703a9b657f01
MD5 91f870af57382d997667d54b7759eb4a
BLAKE2b-256 d1ff61653f05e7f6328d96e128b56500e30d277f09dfe89b9d3b06f81070ab76

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.5-cp314-cp314-manylinux_2_17_x86_64.whl:

Publisher: wheels.yml on zhenzi0322-package/pixlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixlib-1.0.5-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pixlib-1.0.5-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 133.1 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pixlib-1.0.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2f498ca2608dd41fc6db54de7c07778529aafdb9182b07ae19d71958ce59f7b6
MD5 791ceeb995a798db7ffa1d675750768a
BLAKE2b-256 5406450e99f9ae4ddcbcbfd6880e0c5ec15e842f4cbdb53341a3af1521d13a0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.5-cp313-cp313-win_amd64.whl:

Publisher: wheels.yml on zhenzi0322-package/pixlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixlib-1.0.5-cp313-cp313-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pixlib-1.0.5-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 d6d06b68716e117233e6c86010acaaac92fc6fad127a7c680c744fabc7bc27ce
MD5 ccf06bb8fac3e9e9bfdffc15ab8739cb
BLAKE2b-256 401c80425f1c1921e70f76aea318281c80e121186197a6adcb6da2ec69b7bbe0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.5-cp313-cp313-manylinux_2_17_x86_64.whl:

Publisher: wheels.yml on zhenzi0322-package/pixlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixlib-1.0.5-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pixlib-1.0.5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 134.6 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pixlib-1.0.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 30c79f23507961f93c9a9f92c35da5b4cdd38fa8db4dcd0051e0a518028d337f
MD5 d5e9f7f20a90285d1741af74bb90aea1
BLAKE2b-256 ad85a6f9ba2f09de4494d6cda1c70c06c8aa614da5b435efc21894c161531562

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.5-cp312-cp312-win_amd64.whl:

Publisher: wheels.yml on zhenzi0322-package/pixlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixlib-1.0.5-cp312-cp312-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pixlib-1.0.5-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c45f682a7937c701996781e3128385da23ff28487f004cb88a439cc3382b442c
MD5 52fa26fd4427f5f6248db02a0053a8f3
BLAKE2b-256 5340ce80c8353f8042d6ce7b688fad1fec512b8814de0d9cfb20f22203d7929b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.5-cp312-cp312-manylinux_2_17_x86_64.whl:

Publisher: wheels.yml on zhenzi0322-package/pixlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixlib-1.0.5-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pixlib-1.0.5-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 135.5 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pixlib-1.0.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 720d7b8cb0b8da4a1e7aeb2fda90ff25bae10c6ed51d500f68b00e4cfdab78fd
MD5 6720e0605b476d39d859244c83656cc2
BLAKE2b-256 1168b74ecea362b7e4cb0c2d0d377a963490544ac5641308f992363ce5f0bb04

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.5-cp311-cp311-win_amd64.whl:

Publisher: wheels.yml on zhenzi0322-package/pixlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixlib-1.0.5-cp311-cp311-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pixlib-1.0.5-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 4d1ded33821813fa13921681afeaf43fcb8160fb1c9f7c2ecea2508b3c713a6e
MD5 18dbc96d088bf0a98875cb6dff849cbc
BLAKE2b-256 122a3a67056b3e4fa55faf59ce479e9920a0138c5443e68a0b920f035b5d81da

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.5-cp311-cp311-manylinux_2_17_x86_64.whl:

Publisher: wheels.yml on zhenzi0322-package/pixlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixlib-1.0.5-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pixlib-1.0.5-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 136.1 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pixlib-1.0.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 65844da715cdeb7862d00c4ab819dfc6b5b77d41d198ec2497f1d5e53a85d1b2
MD5 769c2a2163af774d91e0eddbcaf6cc9c
BLAKE2b-256 606537008556d1e81934b84a4b2f6ee9cb238b05818ecc1892df902f3ac9210f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.5-cp310-cp310-win_amd64.whl:

Publisher: wheels.yml on zhenzi0322-package/pixlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixlib-1.0.5-cp310-cp310-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pixlib-1.0.5-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 33abbbf4f6cba66d395eab7c40abe2d4caa3344e8a58e36f8cc3c459cd017338
MD5 9d77c7dfb1b84ce2018ef0fce9f62e83
BLAKE2b-256 9bfb96dcb97fe0a2a0b98763666d6b28417f5357e817816b5b65fdcf9e3e800b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.5-cp310-cp310-manylinux_2_17_x86_64.whl:

Publisher: wheels.yml on zhenzi0322-package/pixlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixlib-1.0.5-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pixlib-1.0.5-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 137.2 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pixlib-1.0.5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 657a4bf7a4810be83cbfe31133c6b84fd2840361493473c801d8e831bb6d0c6b
MD5 30bba831aaac79447bb830166a03944b
BLAKE2b-256 194231e4e436b1a54b7f9f3f0d0069cc1eed76cbb75186a4fb0f6d1341186d38

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.5-cp39-cp39-win_amd64.whl:

Publisher: wheels.yml on zhenzi0322-package/pixlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixlib-1.0.5-cp39-cp39-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pixlib-1.0.5-cp39-cp39-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 8ff2991505c380d4818648e27d22d9a4d969211320abf24d85e26ad307d77e60
MD5 17aff229155971fc4c7ca7d0811a5466
BLAKE2b-256 5d8dc85aa5f1a5d8b6f522105ecb5fdda1f504825abde5fe7522dd55415e7e3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.5-cp39-cp39-manylinux_2_17_x86_64.whl:

Publisher: wheels.yml on zhenzi0322-package/pixlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixlib-1.0.5-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pixlib-1.0.5-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 140.9 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pixlib-1.0.5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 00bd84f143bb0c58bebeb6d244953624de3c0e62eb4930f0afdc28375500fe28
MD5 1319823bdd302c940e1401e6595ffa29
BLAKE2b-256 09bc7dc45b8e46ac5d3936ca9dd2f9f3d53f61eb0362e9ba41905a17b70eb98d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.5-cp38-cp38-win_amd64.whl:

Publisher: wheels.yml on zhenzi0322-package/pixlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixlib-1.0.5-cp38-cp38-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pixlib-1.0.5-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6f6395b8488df67a1e3a73b6c98d5892d40f21c83a3f005efd582cfa95083e5d
MD5 392474a0c92abe166d277da44a158831
BLAKE2b-256 b41ad188525d1c7db9d1c0f1ad934e4cc8dd197328459de2ee36450505454c6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.5-cp38-cp38-manylinux_2_17_x86_64.whl:

Publisher: wheels.yml on zhenzi0322-package/pixlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.0.7

14 files

1.0.6

14 files

This release

1.0.5 This release

14 files

1.0.4

14 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