Skip to main content

Various ad hoc image related utility functions and classes.

Latest release 20260531: Tweak temp file name.

Short summary:

  • sixel: Return the filesystem path of a cached SIXEL version of the image at imagepath.
  • sixel_from_image_bytes: Return the filesystem path of a cached SIXEL version of the image data in image_bs.
  • ThumbnailCache: A class to manage a collection of thumbnail images.

Module contents:

  • sixel(imagepath: str) -> str: Return the filesystem path of a cached SIXEL version of the image at imagepath.
  • sixel_from_image_bytes(image_bs: bytes) -> str: Return the filesystem path of a cached SIXEL version of the image data in image_bs.
  • class ThumbnailCache(cs.cache.ConvCache): A class to manage a collection of thumbnail images.

ThumbnailCache.create_thumbnail(self, imagepath: str, thumbpath: str, max_edge: int): Write a thumbnail image no larger than max_edgexmax_edge of imagepath to thumbpath.

ThumbnailCache.thumb_for_path(self, dx, dy, imagepath): Return the path to the thumbnail of at least (dx,dy) size for imagepath. Creates the thumbnail if necessary.

Parameters:

  • dx, dy: the target display size for the thumbnail.
  • image: the source image, an image file pathname or a PIL Image instance.

The generated thumbnail will have at least these dimensions unless either exceeds the size of the source image. In that case the original source image will be returned; this result can be recognised with an identity check.

Thumbnail paths are named after the SHA1 digest of their file content.

ThumbnailCache.thumb_scale(self, dx, dy): Compute thumbnail size from target dimensions.

Release Log

Release 20260531: Tweak temp file name.

Release 20240422.1: Updated DISTINFO.

Release 20240422: Initial PyPI release with ThumbnailCache and SIXEL functions.

Release files for cs-imageutils 20260531

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

Source distribution (sdist)

Source distribution for cs-imageutils 20260531
File Size Uploaded
cs_imageutils-20260531.tar.gz 3.1 kB Details

Built distribution (wheel)

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

Total release size: 6.9 kB

Release files / cs_imageutils-20260531.tar.gz

Download URL cs_imageutils-20260531.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
aaee2a6c3a0fc567090e36ae0c73bd7c9404d6e18dc5a440721409dcf96df985
BLAKE2b-256 checksum
How to use checksums
225ddfba3f323c764ddb274437abb7e4fccbd34891ec5d7c05f8f93330a882ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / cs_imageutils-20260531-py2.py3-none-any.whl

Download URL cs_imageutils-20260531-py2.py3-none-any.whl
Size 3.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
6b64160db734959c3fbf2c55e22566f99e5089215200c8d6c42afe16c2e26d4c
BLAKE2b-256 checksum
How to use checksums
bc0127993c3baea4401ff847befff09ed090a505259f0b574198cc972d39fefd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

20260531 This release

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