Transform your Python code in an image.
Project description
pytoimage
Note: pytoimage is still in its initial stages, for now, you can normally transform your code in an image, choosing the backgroud and the text color. But, all code is currently with a single color, not differentiating anything, such as keywords, strings, functions... this will come in future versions.
Download
You can simply:
pip install pytoimage
Or you can also:
- Clone the repository to your local machine.
- Enter the directory.
- Download necessary modules/libraries.
git clone https://github.com/gabrielstork/pytoimage.git
cd pytoimage
pip install -r requirements.txt
Example
from pytoimage import PyImage
The PyImage class has three parameters: path (the Python code path), background (optional, the background color of the image) and font (optional, the path of a .ttf font).
code = PyImage('pytoimage/pytoimage.py', background=(15, 15, 15), font='fonts/Inconsolata.ttf')
The following method is optional, it allows you customize the theme of your image (see initial note).
palette = {
'line': (149, 149, 149),
'normal': (255, 255, 255),
}
code.set_color_palette(palette=palette)
To generate the image, you can simply call the method with no arguments, the start and end are optionals, these are the code intervals.
code.generate_image(start=39, end=51)
Then you can see and save the generated image.
code.show_image()
code.save_image('images/example.png')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pytoimage-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fdee6a385fa57e0d3f993687e54f84dcb4d84c58d24556cc70ac8b227f515cd |
|
MD5 | 94a5fb23f6d26504f24a64d6d5ed11a1 |
|
BLAKE2b-256 | 66aaf542263ae3d88f64a285251e9a5c7012f3623c7ed67e0ac20f6a069594bb |