Skip to main content

A Python library for converting images into FPGA-displayable pixel art.

Project description

Picture2Pixel is an open-source Python library designed to transform images into pixel art that can be displayed on FPGA-driven OLED screens. By employing advanced computer graphics techniques, this library preprocesses images to minimize distortion during the pixelation process. The resulting artwork is expressed as combinations of predicate logic in Verilog language, ensuring compatibility with FPGA technology. This optimization not only enhances display efficiency on OLED screens but also reduces energy consumption, making it ideal for developers looking to integrate low-power, high-efficiency visual displays into their hardware projects.

Picture2Pixel can also convert both single images and batches of images (including GIFs) into formats suitable for FPGA OLED displays. Please view more magnificent demos on our website: Picture2Pixel.org

Project Wiki (MUST READ!)

We have created a comprehensive Wiki for the Picture2Pixel project, which includes development documentation, tutorials, and examples to help developers deploy, use, and further develop our project.

Installation

Install the picture2pixel package using pip:

pip install picture2pixel

Usage

Convert Image to Pixel Data

Convert an image to pixel data and generate Verilog code:

python -m picture2pixel.convert2pixel <image_url> <width> <height> <svd_r> <output_dir>

Example:

python -m picture2pixel.convert2pixel https://www.comp.nus.edu.sg/~guoyi/project/picture2pixel/tests/default.png 96 64 20 output_directory

Convert Pixel Data to Image

This function is for Convert pixel data from a .p2p file back into an image:

python -m picture2pixel.convert2picture <p2p_file> <width> <height> <output_dir>

Example:

python -m picture2pixel.convert2picture https://www.comp.nus.edu.sg/~guoyi/project/picture2pixel/tests/default.p2p 96 64 output_directory

Library Structure

picture2pixel/
├── __init__.py
├── convert2pixel.py
├── convert2picture.py
├── image_processing.py
├── verilog_generator.py
├── tests/
│   ├── __init__.py
│   ├── test_picture2pixel.py
│   ├── test_pixel2picture.py
│   ├── test_integrated.py
README.md
requirements.txt
setup.py

MIT License

Copyright (c) <2024> <copyright Chen Guoyi, Fang Sihan>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Picture2Pixel Python Library is developed and maintained, also copyrighted by:

Picture2Pixel Python Library is released to PyPI.

THIS PROJECT IS SPONSORED BY THE DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING, NATIONAL UNIVERSITY OF SINGAPORE.

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

picture2pixel-1.0.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

picture2pixel-1.0.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file picture2pixel-1.0.0.tar.gz.

File metadata

  • Download URL: picture2pixel-1.0.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.1

File hashes

Hashes for picture2pixel-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e4c60227944dd306893e953ca4f1f72c42a23cd35ec4f83cdfe9788fc88b3c0e
MD5 c6c6a343ebc2495efceb5f72b1151f47
BLAKE2b-256 c43036a546f7b4b480f1f8f7a1e921d0c48256a645bb91644f23a4fe006e5ab3

See more details on using hashes here.

File details

Details for the file picture2pixel-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for picture2pixel-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 79efaf4d57d1bde770dc7650ae3224fd1b4737ac17020c77c567962093e75b1d
MD5 2bc5cce7ebfa4450c62bbc9f760ad8d5
BLAKE2b-256 dc8a6303be69ab179efaa1be22d70a260b5b4b194fde02b6d1494f9c848a455e

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