Takes pictures of code!
Project description
This package takes pictures of source code
Example code:
from sshot import shot
from PIL import Image
code='''
print('Hello World!')
'''
image=shot(code,lang='python')
Image.fromarray(image).save('code.png')
The code above will create something like:
Use in command line:
sshot -i test.py -l python -o code.png
sshot -i test.py -l python -o code.png -b bg.png # Add background image.
sshot -i test.py -l python -o code.png -b 00FF00FF0000 # Red code background color, green line number background color.
sshot -i test.py -l python # Show the image in a tkinter window.
It is also supported to set the background image of code, like:
from sshot import shot
from PIL import Image
from sshot.background import Background
import numpy as np
code='''
print('Hello World!')
'''
bg=np.array(Image.open('bg.png'))
image=shot(code,lang='python',background=Background(bg))
Image.fromarray(image).save('code.png')
Added SVG support, but other packages are required.
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
sourceshot-1.0.2.tar.gz
(6.6 kB
view hashes)
Built Distribution
Close
Hashes for sourceshot-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16117dec625b6c025582f50c6b2fe2c5cf5b0a8eb2bc9f9c8692d65217db2083 |
|
MD5 | 89edccd70f07b64ca6c12a863eb924d4 |
|
BLAKE2b-256 | 269afbe44e8a67b02552e332b8d9a3cfaadb77cb6d0ad3ed04f400bf12eb5e6b |