- Works with any image (vertical images work better than horizontal ones)
- Works with most text (see below)
- Any monospaced font works, but you need to count the # of characters per line, excluding the new line
- Does not work with tabs, lists, bullet point lists, images, tables etc. TEXT ONLY.
- Does work with spaces/line breaks, however
- Single spaced for best results
- This is more of a proof of concept/for fun rather than anything practical
- Download an image, rename it to input.png (if it is a png), and put it in the same directory as
color.py
- Uses Pillow from pip:
python3 -m pip install --upgrade Pillow
- Run
color.py
with python, or, if you have a jpeg or want more features, run with the paramters below: - Run
color.py
with parameters[TEMPLATE STRING] [FILE NAME] [CHARACTERS PER LINE]
- The following selectors are available
{a}
alpha value from 0-255{r}
red value from 0-255{g}
green value " "{b}
blue value " "{x}
x position of this pixel{y}
y position of this pixel{bw}
0 if white, 255 if black{ha}
alpha hex value (e.g. FF){hr}
red hex value{hg}
green hex value{hb}
blue hex value\n
new line
- By default, the code will replace the selector with the actual value for EACH pixel value in the image.
The default template is
#{hr}{hg}{hb}
. Note the space as the values are appended tooutput.txt
with straight concatenation - The default resize is to 70 pixels wide (preserves proportions). The default file is input.png
- Using defaults, your output.txt should look like
#ABCDEF #123456 #ABC123 #FFFFFF etc.
- Create a new google doc, and paste the output of output.txt from before. The data may be 50+ pages. Be patient.
- In google docs (the doc with text you want to have the image "overlayed" on, not the previously created doc), go to
Tools > Script Editor
and import the .gs files. Make sureDocUtils.gs
is at the top. - Save and return to the original doc. There should be a new menu item next to "Help" in the top bar
- Click on the option and it will prompt you. Follow the defaults or change them if you'd like
- When it asks for an SRC link, COPY the URL of the google doc you pasted data into earlier in step 1
- Wait for 30 seconds and it should highlight everything automatically