https://github.com/henryrobbins/dmtools
A Python package providing low-level tools for working with digital media programmatically.
https://github.com/henryrobbins/dmtools
digital-media ffmpeg image-processing low-level netpbm
Last synced: about 1 month ago
JSON representation
A Python package providing low-level tools for working with digital media programmatically.
- Host: GitHub
- URL: https://github.com/henryrobbins/dmtools
- Owner: henryrobbins
- License: mit
- Created: 2021-08-25T03:33:39.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-07-17T02:46:47.000Z (almost 2 years ago)
- Last Synced: 2025-12-28T00:12:28.177Z (6 months ago)
- Topics: digital-media, ffmpeg, image-processing, low-level, netpbm
- Language: Python
- Homepage: https://dmtools.henryrobbins.com
- Size: 7.37 MB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 
[](https://pypi.python.org/pypi/dmtools/)
[](https://app.circleci.com/pipelines/github/henryrobbins/dmtools)
[](https://dmtools.readthedocs.io/en/latest/?badge=latest)
[](https://codecov.io/gh/henryrobbins/dmtools)
dmtools (Digital Media Tools) is a Python package providing low-level tools for
working with digital media programmatically. It supports the PNG and [Netpbm][1]
image file formats as well as the MPEG-4 and [WAV][2] video and audio file
formats respectively.
The `transform` module provides image transformation tools such as rescale
(based on the [ImageMagick][3] implementation) and composite (based on the
[Cairo][4] 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][8].
# Installations
The quickest way to get started is with a pip install.
```
pip install dmtools
```
The `animation` module requires [ffmpeg][5] which you can install with a package
manager like [Homebrew][6]. Note that this may take some time to install.
```
brew install ffmpeg
```
For in-depth installation instructions see [Installation][7].
# 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][9] in [Tutorials][10]. Both the input image
`checks_5.png` and output image `result.png` can be found in the [dmtools][11]
GitHub repository.
```python
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*

*result.png*
## License
Licensed under the [MIT License](https://choosealicense.com/licenses/mit/)
[1]: "Netpbm"
[2]: "WAV"
[3]: "ImageMagick"
[4]: "Cairo"
[5]: "ffmpeg"
[6]: "Homebrew"
[7]: "Installation"
[8]: "Documentation"
[9]: "Introduction"
[10]: "Tutorials"
[11]: "dmtools"