Skip to main content

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:

  1. Clone the repository to your local machine.
  2. Enter the directory.
  3. 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()

Example

code.save_image('images/example.png')

forthebadge forthebadge

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

pytoimage-0.0.1.tar.gz (56.9 kB view details)

Uploaded Source

Built Distribution

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

pytoimage-0.0.1-py3-none-any.whl (55.2 kB view details)

Uploaded Python 3

File details

Details for the file pytoimage-0.0.1.tar.gz.

File metadata

  • Download URL: pytoimage-0.0.1.tar.gz
  • Upload date:
  • Size: 56.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for pytoimage-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1f5798d43988f99e35ee7765bc7a15902bfc63ad7da4750766b3150a1ae46c4d
MD5 7f00e67fc4c0e28cd3797e8fae9ef874
BLAKE2b-256 4706bbed2f6751e7f60582d8b100842520b57aaf946cfa8cae3eb908887fb0a6

See more details on using hashes here.

File details

Details for the file pytoimage-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pytoimage-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 55.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for pytoimage-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7fdee6a385fa57e0d3f993687e54f84dcb4d84c58d24556cc70ac8b227f515cd
MD5 94a5fb23f6d26504f24a64d6d5ed11a1
BLAKE2b-256 66aaf542263ae3d88f64a285251e9a5c7012f3623c7ed67e0ac20f6a069594bb

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