Learning Python and being creative. Making art with code.

All titles of Shakespear’s sonnets

What is this?

Why? And Why Python?

Planning

  • The colours created from the words should get the colour values using every letter, not just the first few.
  • The ‘canvas’ on which the colours sit should be adjustable, I should be able to print a huge image of a whole book, or a small image of my name.
  • The final rendering should be an image, not a web view.

An example: the letters ‘Abcd’ as a word

# position   0   1   2   3   4   5  ...
alphabet = ["a","b","c","d","e","f",...]
  • Word is ‘Abcd’
  • Values are [0,1,2]
  • Remaining values are [3]
  • Add [3] to the first value (0).
Some small word examples

What happens with large words?

  • Word is ‘Abcdefghij’
  • Values are [0,1,2]
  • Remaining values are [3,4,5,6,7,8,9]
  • For each of the remaining values, go through the initial values and add them to the 3 RGB values one at a time so,
  • Remaining value 3 is added to val[0]
  • Remaining value 4 is added to val[1]
  • Remaining value 5 is added to val[2]
  • Remaining value 6 is added to val[0]
  • Remaining value 7 is added to val[1]
  • Etc
for i, j in zip(cycle(range(len(colors))), additions):
colors[i] += j
colors[i] = int(colors[i])
Adding to the initial RGB values, getting smaller and smaller as the word grows
(left) E.E Cummings — I carry your heart with me (right) William Carlos Williams — The Red Wheelbarrow

What about large text inputs?

The King James Bible — In squares

Drawing, Plotting, and Some Note-taking.

Working out the plotting of the word squares
[[45,65,221],[36,187,35],[66,84,224]...]
  • Given I know how many squares I have (5) I work out what ‘grid’ I will need. For example, 5 words would require a 3 x 3 grid.
  • Now I know each row and column will consist of three squares, and I have a canvas size of 1000. 1000 / 3 will be the width and height of each inner square. And also the amount of distance I need to shift my drawing points horizontally and vertically.
  • To find what ‘grid’ I need, I created a function (grid(n,m)) that takes the list of words and a list of squared numbers and works that out:
Calculating the grid
Drawing the squares.

--

--

--

Developer, I also make art and listen to techno https://www.kevinhowbrook.com/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Code>-<Prose; Code-Code-ify-Codify

500–920 DCITUC Exam Questions — Cisco Data Center Unified Computing Infrastructure Troubleshooting

Getting started with Async requests in Flask using Httpx

Appvalley Spotify++ Download

Communication is the key to readability

Iteration I2: Connecting to a Slow Payme nt Processor with Active Job

images/ActiveJobFlowDetail.png

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kevin howbrook

Kevin howbrook

Developer, I also make art and listen to techno https://www.kevinhowbrook.com/

More from Medium

Short Guide for Numpy

Python, the developer-oriented programming language

Using World Bank Data on Pandas for Beginners

All about Classes in Python