Various ad hoc image related utility functions and classes.
If you're using the SIXEL support (images in the terminal) I recommand also installing libsixel.
Short summary:
-
sixel: Return the filesystem path of a cached SIXEL version of the image atimagepath. -
sixel_from_image_bytes: Return the filesystem path of a cached SIXEL version of the image data inimage_bs. -
ThumbnailCache: A class to manage a collection of thumbnail images.
Functions
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.
Classes
class ThumbnailCache(cs.cache.ConvCache)
A class to manage a collection of thumbnail images.
ThumbnailCache.DEFAULT_CACHE_BASEPATH
'~/var/cache/im/thumbnails'
ThumbnailCache.DEFAULT_MIN_SIZE
16
ThumbnailCache.DEFAULT_SCALE_STEP
2.0
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.
Metadata
Release files for cs-imageutils 20261016
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cs_imageutils-20261016.tar.gz | 5.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cs_imageutils-20261016-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 12.4 kB
Release files / cs_imageutils-20261016.tar.gz
| Download URL | cs_imageutils-20261016.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ecc3e850228fb1e8a2c1db01713f204f054b88ec3d839db4be43b464bdc3d0cf
|
|
BLAKE2b-256 checksum How to use checksums |
886f2733f56d5ba89193d2d000c55cc487dd74a55a95ffd4f46825531f91832a
|
| 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-20261016-py2.py3-none-any.whl
| Download URL | cs_imageutils-20261016-py2.py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
2773c1746a5f679c82e07fcd4c5edbd31556cd1d7851f11b7564251040d78d40
|
|
BLAKE2b-256 checksum How to use checksums |
d9af2a1fe99b62032aa6406fe62e0be7f8266ee46424875cf7db949dc696dadf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|