Skip to main content

Loader for the farbfeld image format.

Project description

farbfeld.py

This is a small Python module for extracting pixel data from farbfeld images: https://tools.suckless.org/farbfeld/

Currently it only has one public function, farbfeld.read. It returns the pixels as row by row, column by column as a nested list.

Usage

To read an image, open the desired file and read the pixels from it using farbfeld.read:

import farbfeld

with open('image.ff', 'rb') as f:
    data = farbfeld.read(f.read())

Since farbfeld stores pixel components as 16-bit unsigned integers, it may be useful in some cases to normalize them to the [0, 1] range. Then you can visualize it, for example using matplotlib:

import farbfeld
import matplotlib.pyplot as plt

with open('image.ff', 'rb') as f:
    data = farbfeld.read(f.read(), normalize=True)
    plt.imshow(data, interpolation='nearest')
    plt.show()

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

farbfeld-0.1.0.tar.gz (2.5 kB view hashes)

Uploaded Source

Built Distribution

farbfeld-0.1.0-py3.7.egg (4.0 kB view hashes)

Uploaded Source

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