Skip to main content

AI image processing toolkit - plain color detection, image validation, URL image download, hash rename, MD5 and random string utilities

Project description

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 输入
  • 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)

# 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"})

Project details


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.4-cp314-cp314-win_amd64.whl (126.8 kB view details)

Uploaded CPython 3.14Windows x86-64

pixlib-1.0.4-cp314-cp314-manylinux_2_17_x86_64.whl (813.5 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

pixlib-1.0.4-cp313-cp313-win_amd64.whl (123.8 kB view details)

Uploaded CPython 3.13Windows x86-64

pixlib-1.0.4-cp313-cp313-manylinux_2_17_x86_64.whl (819.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pixlib-1.0.4-cp312-cp312-win_amd64.whl (125.3 kB view details)

Uploaded CPython 3.12Windows x86-64

pixlib-1.0.4-cp312-cp312-manylinux_2_17_x86_64.whl (836.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pixlib-1.0.4-cp311-cp311-win_amd64.whl (125.8 kB view details)

Uploaded CPython 3.11Windows x86-64

pixlib-1.0.4-cp311-cp311-manylinux_2_17_x86_64.whl (814.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pixlib-1.0.4-cp310-cp310-win_amd64.whl (126.5 kB view details)

Uploaded CPython 3.10Windows x86-64

pixlib-1.0.4-cp310-cp310-manylinux_2_17_x86_64.whl (775.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pixlib-1.0.4-cp39-cp39-win_amd64.whl (127.5 kB view details)

Uploaded CPython 3.9Windows x86-64

pixlib-1.0.4-cp39-cp39-manylinux_2_17_x86_64.whl (775.4 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

pixlib-1.0.4-cp38-cp38-win_amd64.whl (131.2 kB view details)

Uploaded CPython 3.8Windows x86-64

pixlib-1.0.4-cp38-cp38-manylinux_2_17_x86_64.whl (803.0 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pixlib-1.0.4-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 fdb85b25bf112597ae94dcd137223a12ac52cd1594ffa9525e2ca684523902b3
MD5 a7ba95c3a550a891949cb8e128eb07b7
BLAKE2b-256 98f37aa57934b6e74bdb24a3f57485ea7b2334a806cbe4ce9dfe014da9eaec0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.4-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.4-cp314-cp314-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pixlib-1.0.4-cp314-cp314-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a54d0e4bbe003f5a45760fe8db17887ac19dada2ce0a04e3163654627631c367
MD5 43c9867b86df1020156921447b5ea5c7
BLAKE2b-256 c460728261a014933cfe4fc8e4a4a9c678019f8b5f7fb6358aae518f10164eaf

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.4-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.4-cp313-cp313-win_amd64.whl.

File metadata

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

File hashes

Hashes for pixlib-1.0.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 afb3b2492b6c6f327f0918846f0c46dbe7f609e473637acac1b62f68f1086f1e
MD5 a269451d41353df9ec5f6a5e55fec9d8
BLAKE2b-256 0e9b0e0d1adedb711ab549f5435183c60ecfefe5f643df5bedb9db12b6e12dec

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.4-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.4-cp313-cp313-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pixlib-1.0.4-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a1962e63172502ab1d0329f5b24dc3ba5629b1973053f725e0112e3cfab1c992
MD5 97d37cd4eb5ecfe76e0d281dcc80e4d6
BLAKE2b-256 2a4582074b39b4d4f4517f426c4a994833f1b00289cf21e4add99d3724e4f6c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.4-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.4-cp312-cp312-win_amd64.whl.

File metadata

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

File hashes

Hashes for pixlib-1.0.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c2ca5dabeaf485f86e32aa38631a286154c56d28369ab6b8f57f8d66da226bf1
MD5 a37ffd2cae5f8d032b4da8be27d6343a
BLAKE2b-256 8e46258f6d55fad357339152ee6d3686021acbd0e939056cc4780309f956d488

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.4-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.4-cp312-cp312-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pixlib-1.0.4-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 1dee92f9cda47d10c212063f6a67c070db0994b58f822ca7c935bd867fd4b6fe
MD5 804d82c0859ba17cc1f6d4ec333641b9
BLAKE2b-256 84dc5dfc3e83779e9c96737f77e0c2fb174b575fb829ffb5973c1fb1e75ad47f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.4-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.4-cp311-cp311-win_amd64.whl.

File metadata

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

File hashes

Hashes for pixlib-1.0.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1102373afaf6a8058e86cee1ec0399ce10a8bca7586042e2825b44a90589afde
MD5 53297c80c921d7cf3941f3f8b5e5dbc5
BLAKE2b-256 f7afdee047962cb06a1edb3a42948475f8181934d143801a9e90bc1d8d2d767b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.4-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.4-cp311-cp311-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pixlib-1.0.4-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 61bce5b99aa3fe5a6278bb9a34e56f16bcfb6de5003e94150a9e165b2752967d
MD5 d67391f6bf7e498cf5f01d78e0f1e788
BLAKE2b-256 76d449a337f5cf2efed309904abb8e49f8aee47848026d6c11e3cd5a2b871cd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.4-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.4-cp310-cp310-win_amd64.whl.

File metadata

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

File hashes

Hashes for pixlib-1.0.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 25ac4403bb8832b48c2dc24c2c1828edf124043803af1f1883b8c26546d2faad
MD5 2b4bd432c5311699068aed2d03280f7a
BLAKE2b-256 17def32bd039f39b6f9d57d9c6d25c8ce496418adba6b0f33a2f610ac3139ec0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.4-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.4-cp310-cp310-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pixlib-1.0.4-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 1fa0aa47c072d6b2fd23617627ad72f6c148e0738185e260d9221cad16e976ab
MD5 9163399aa48206b5d59118a37dbbb394
BLAKE2b-256 5778349433d1256a1f3458b20654953a7ca9323202854eecacd5d0b0fb568234

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.4-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.4-cp39-cp39-win_amd64.whl.

File metadata

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

File hashes

Hashes for pixlib-1.0.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 52c8d6dcc0094b6c09a333633e25e267e93db373f0efc77898da0380cf817968
MD5 0bd90904e3bea334e2e9d9f6f04706e9
BLAKE2b-256 ec7dc3ab09455a9b58e02aa851aea60a3939c142c47bbe94dc0ff22c2e6966eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.4-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.4-cp39-cp39-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pixlib-1.0.4-cp39-cp39-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 3921bddfc874b34b6662870d3a3df07fc1cdda3db4ae0022a987451e970de853
MD5 18e82f35a106b6602e3f169c8e65b491
BLAKE2b-256 4f017843abd41d81b72654157b9da8a0fbe3df3aa3b4c96e824f3a72b5dd5e64

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.4-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.4-cp38-cp38-win_amd64.whl.

File metadata

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

File hashes

Hashes for pixlib-1.0.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 2a040cb8869b0cbc3ff118c7e20da15258e6693c07bd91acaa606ec736d1fbaf
MD5 ca0f094007372b9cc5831ec0d2e5ac87
BLAKE2b-256 01a0af9e3d49b49d3d555defc254ee830e493fe44ea87dae67d2624b3a0f2c69

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.4-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.4-cp38-cp38-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pixlib-1.0.4-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c00fb4dc51cf237228a3f101be80a9dc0748bc44dcc45887d6d2026887e99ff1
MD5 c319edb7e2d0a439c91c2a92999814a1
BLAKE2b-256 c94f9d8bff97c94aaa39d22e464c76bac4354a1f5259e94cc67c489c2c325bc9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixlib-1.0.4-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.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page