Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions text/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ WORKDIR /usr/src/app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
RUN python -m nltk.downloader -d /usr/local/share/nltk_data wordnet

WORKDIR /opt/work
#COPY . .

#CMD [ "python", "./your-daemon-or-script.py" ]
#CMD [ "python", "./your-daemon-or-script.py" ]
2 changes: 1 addition & 1 deletion text/build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
docker build . -t python-data-art
docker build . -t python-data-art
13 changes: 8 additions & 5 deletions text/pil.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
- https://stackoverflow.com/questions/704152/how-can-i-convert-a-character-to-a-integer-in-python-and-viceversa
"""
import math
from PIL import Image, ImageColor
import nltk
from PIL import Image


"""
Expand Down Expand Up @@ -46,10 +45,14 @@ def get_img_dim(text):



height = int(math.sqrt(len(text))) / 3
width = height
num_pixels = math.ceil(len(text) / 3)
height = width = int(math.ceil(math.sqrt(num_pixels)))
print("[*] w = {0}, h = {1}".format(width, height))

expected_len = width * height * 3
if len(text) < expected_len:
text = text.ljust(expected_len, '\0')

#get_img_dim(text)

im = Image.new('RGBA', (width, height))
Expand All @@ -66,4 +69,4 @@ def get_img_dim(text):
im.putpixel((x, y), (ord(text[i]), ord(text[i+1]), ord(text[i+2])))
i = i + 3

im.save('putPixel.png')
im.save('putPixel.png')
4 changes: 1 addition & 3 deletions text/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
###### Requirements without Version Specifiers ######
#nose
#nose-cov
nltk
Pillow
2 changes: 1 addition & 1 deletion text/run.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
docker container run -it --rm -v $(pwd):/opt/work python-data-art bash
docker container run -it --rm -v $(pwd):/opt/work python-data-art bash