Skip to main content

A Python package providing low-level tools for working with digital media programmatically.

Project description

dmtools

PyPI pyversions CircleCI Documentation Status codecov

dmtools (Digital Media Tools) is a Python package providing low-level tools for working with digital media programmatically. It supports the PNG and Netpbm image file formats as well as the MPEG-4 and WAV video and audio file formats respectively.

The transform module provides image transformation tools such as rescale (based on the ImageMagick implementation) and composite (based on the Cairo implementation). The adjustments module provides a curves tool and the colorspace module provides colorspace conversion tools. The arrange module provides image layout tools. Lastly, the animation and sound modules provide tools for working with video and sound respectively. For more details, see the Documentation.

Installations

The quickest way to get started is with a pip install.

pip install dmtools

The animation module requires ffmpeg which you can install with a package manager like Homebrew. Note that this may take some time to install.

brew install ffmpeg

For in-depth installation instructions see Installation.

Usage

The usage example below illustrates how an image can be read, manipulated, and exported using dmtools. It features a change of color space, inversion of the red channel, and blur. For more usage examples, see the Introduction to dmtools in Tutorials. Both the input image checks_5.png and output image result.png can be found in the dmtools GitHub repository.

import dmtools
from dmtools import colorspace, transform, adjustments, arrange

image = dmtools.read("checks_5.png")
image = colorspace.gray_to_RGB(image)
image = adjustments.apply_curve(image, lambda x: 1 - x, 0)
image = transform.blur(image, 5)
image = arrange.image_grid([image]*2, 2, 1, 15, color=1)

dmtools.write_png(image, "result.png")

checks_5.png

checks_5.png

result.png

result.png

License

Licensed under the MIT License

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

dmtools-0.5.0.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

dmtools-0.5.0-py3-none-any.whl (26.3 kB view details)

Uploaded Python 3

File details

Details for the file dmtools-0.5.0.tar.gz.

File metadata

  • Download URL: dmtools-0.5.0.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8

File hashes

Hashes for dmtools-0.5.0.tar.gz
Algorithm Hash digest
SHA256 ce0e69c01d8a16c5bf8927923ec0dba3c15124becf9d09b1e9368796d649913f
MD5 c23812b6c0d9a7647f7206e47f9878f7
BLAKE2b-256 257e49f6c73a0530c6d4059ed20294df83fcacc4f98f21fe57abe8670770a09c

See more details on using hashes here.

File details

Details for the file dmtools-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: dmtools-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 26.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8

File hashes

Hashes for dmtools-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7b81ab5e4c2be6118462496a3b3e60893435b51c896cbe4c9771a96c8174454
MD5 605bd3adf6e2656345751d11875ec29a
BLAKE2b-256 0ac31d171f1da02e43af2b43384968a6171432d59c2f2d7e05387012a45cc343

See more details on using hashes here.

Supported by

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