Skip to main content

Various ad hoc image related utility functions and classes.

Project description

Various ad hoc image related utility functions and classes.

Latest release 20240422.1: Updated DISTINFO.

Function sixel(imagepath: str) -> str

Return the filesystem path of a cached SIXEL version of the image at imagepath.

Function 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.

Method 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.

Method 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.

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

Release Log

Release 20240422.1: Updated DISTINFO.

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

Project details


Download files

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

Source Distribution

cs.imageutils-20240422.1.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

cs.imageutils-20240422.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file cs.imageutils-20240422.1.tar.gz.

File metadata

  • Download URL: cs.imageutils-20240422.1.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.6

File hashes

Hashes for cs.imageutils-20240422.1.tar.gz
Algorithm Hash digest
SHA256 957806c366308611b61aefdbeccf5ccfb3059dbd2bc72fa94d6594738b48d663
MD5 87934f3775f719073682b1eeded652c0
BLAKE2b-256 b7b0ec629bcaadca99b650f9802090ff8ddd21f52d27bd83ae1d6a2f55510bd0

See more details on using hashes here.

File details

Details for the file cs.imageutils-20240422.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cs.imageutils-20240422.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e43e4bc8756830cfd005034c0ae0b0100c8c0305ec19cf3760be078d8a418c8
MD5 d553656012c3764bcdfc9ee3eab97cda
BLAKE2b-256 1d980bf715ba40b1468041f057a029c9fe538491990566663aff15177311387c

See more details on using hashes here.

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