Skip to main content

A library for image file manipulation, focused on data corruption and glitch effects.

Project description

pyglitch A library for image file manipulation, focused on data corruption and glitch effects.

Introduction pyglitch is a simple yet powerful tool for creating artistic data corruption effects on image files. By directly manipulating the raw byte data of an image, this library produces unique and unpredictable "glitches" that can be used for digital art and creative projects.

The library supports popular image formats like JPEG and PNG by navigating their file headers and focusing corruption on the main image data.

Installation You can install pyglitch directly from PyPI (when published) or from a local source.

To install from a local source:

pip install .

The library has no external dependencies beyond Python's standard library.

Usage The main function you will use is glitch_img(). You can import it directly from the main package, as shown below.

glitch_img(image_path, output_path, corruption_level)

image_path: The path to the input image file (e.g., 'my_photo.jpg').

output_path: The path where the glitched image will be saved (e.g., 'glitched_photo.jpg').

corruption_level: (Optional) A float representing the percentage of the file's data to corrupt (e.g., 0.05 for 5%). The default value is 0.01.

Example Here is a simple Python script to use the pyglitch library:

from pyglitch import glitch_img

input_image = 'path/to/your/image.jpg' output_image = 'path/to/save/glitched_image.jpg'

Glitch the image with a 2% corruption level

glitch_img(input_image, output_image, corruption_level=0.02)

print(f"Glitched image saved to {output_image}")

Contributing pyglitch is an open-source project. If you have an idea for a new type of glitch effect or an improvement, please feel free to contribute!

License This project is licensed under the MIT License. See the LICENSE file for details.

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

pyglitch-0.1.1.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyglitch-0.1.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file pyglitch-0.1.1.tar.gz.

File metadata

  • Download URL: pyglitch-0.1.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for pyglitch-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b9fa88d660ae0952fe0dc0df9d18f296cc74bf81a3e26b1dbc49d41fe5950a05
MD5 da69880daa477de7ee6870c9fb98c2a9
BLAKE2b-256 8868e3af52517528fe02ff13830761a11eac9229c7e294187c6e1642697a8aae

See more details on using hashes here.

File details

Details for the file pyglitch-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyglitch-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for pyglitch-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ab6b149ee69310bb5b06d49fa9457b7ecb92b46e112f615c5f6558daa6b84155
MD5 968dd01a364aca3f3c7be74fbd00ad03
BLAKE2b-256 8fbce77607be4181abdda03d4cd33e02f8205009c7679e551963edbf63c03a1b

See more details on using hashes here.

Supported by

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