Skip to main content

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

Project description

dmtools

PyPI pyversions Documentation Status

dmtools (Digital Media Tools) is a Python package providing low-level tools for working with digital media programmatically. The netpbm module allows one to read and create Netpbm images. Color space transformations can be done with the colorspace module. Using ffmpeg, the animation module can export .mp4 videos formed from a list of images and the sound module can be used to add sound to these videos as well. Lastly, ASCII art can be produced with the ascii module.

Installation

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

Usage

The most common use case consists of reading a Netpbm image, transforming it in some way, and then writing the resulting image to a Netpbm or PNG format. In the example below, we read a Netpbm image called example.pbm, swap the black and white pixels, and then write the new image to example.png.

import numpy as np
from dmtools import netpbm

image = netpbm.read_netpbm('example.pbm')
M = -(image.M - 1)
image = netpbm.Netpbm(P=1, k=1, M=M)
image.to_png('example.png')

example.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.1.2.tar.gz (11.6 kB view hashes)

Uploaded Source

Built Distribution

dmtools-0.1.2-py3-none-any.whl (13.0 kB view hashes)

Uploaded Python 3

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