Craftpainting
Create Minecraft-like paintings in the terminal
🚀 Usage
Install it by running
pip install craftpainting
# on on mac,
pip3 install craftpainting
CLI
craftpainting input_path.png -s SIZE -r REPETITIONS -o output_path.png
size
Enter a string of WxH, such as 2x1. Units are Minecraft blocks, so a width of 2x1 translates to an image of 32x16.
repetitions
The number of times enlarge the image. By default, an image 32x16 or 48x32 is too small and doesn't look good.
The value of -r dictates how many times each pixel should be multiplied. It's 15 by default, so an image of size 2x1 in blocks looks like it's 32x16 pixels, but is actually 480x240.
Set to 0 to get the minimum possible size.
gray
Append -g (or --gray) to the command to make the painting black and white.
outputpath
If no output path is specified, the image will be shown, but won't be saved.
Python
from craftpainting import create_painting, enlarge_image
from PIL import Image
image = Image.open('images/sunset_dense.jpg')
p = create_painting(image) # create the (super tiny) image
p = enlarge_image(p, repetitions=15) # enlarge it so it looks better
p.show()
To use in Python, Pillow is required. Install it:
pip install pillow
# or on mac,
pip3 install pillow
Web
Visit craftpainting.herokuapp.com.
Note: the website is hosted on Heroku on the free plan, so it will take around 10 seconds to load.
🏳️🌈 Examples
Sunset dense
craftpainting sunset_dense.jpg -o painting_sunset_dense.jpg
Original
Beach
craftpainting beach.png -s 3x2 -o painting_beach.png
Original
Code
craftpainting code.jpg -s 2x2 -o painting_code.jpg
Original
Landscape
craftpainting landscape.jpg -g -r 5 -o painting_landscape.jpg
Smaller values of repetitions produce images of smaller sizes.
Original
🛠 Build setup
# install all packages
cd src/
pipenv shell
pipenv install
# run test.py
python test.py
Web
cd web/
pipenv shell
pipenv install
# run the site on the dev server
python app.py
# host on heroku
git add .
git commit -m "update site"
cd .. # go to the route directory
git subtree push --prefix web heroku master
📜 License
- MIT
- Sunset Dense taken from Minecraft Gamepedia
- Other images taken from Pexels
Metadata
Release files for craftpainting 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| craftpainting-0.0.3.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| craftpainting-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.6 kB
Release files / craftpainting-0.0.3.tar.gz
| Download URL | craftpainting-0.0.3.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fef9294427a42aec9c997ad8d8125edc70ec42357874cf3190b3586d90c1c97b
|
|
BLAKE2b-256 checksum How to use checksums |
b8f485f5347d650c19c3d87d627b98638b8bfb494983f0d7741599e25e73aa10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6
|
Release files / craftpainting-0.0.3-py3-none-any.whl
| Download URL | craftpainting-0.0.3-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e7a5eeff615874b19030a4cd22c2590264787f40afadea5e0f4081b1f23665d0
|
|
BLAKE2b-256 checksum How to use checksums |
477d8dcf7ac985d69928b8be0dd5a2d05d49023b9ba494448632b5713c372201
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6
|