InkyPhat cannot write in straight lines


I’m currently using a v2 red/black/white InkyPhat on a Pi zero W and I’ve just noticed an odd line up issue with some of the letters (‘t’ being the main culprit) where they are not sitting on the line with other letters or numbers.

Thinking it is the font - I’ve download other fonts and tried them to similar results - the characters shift up but not the same ones…

For example, if you look at this blurred picture under the ‘k’ of the title you will see a 1 pixel step up in the line (due to a program error that can be ignored) but the issue can be seen on / under the ‘t’ in network, router and last All are are above the preceding and next characters.

The code used to ‘print’ the line of text are based on the given examples:

inkyphat.text((leftindent, top), text, colours[textcolour], font=font)

Anyone any ideas?


The top of the t is lined up with the other text, its just the bottom thats truncated? The 1’s in the date time are the same way? I’d have said “font issue” too?
What does the (leftindent, top) do?


Hence the change in font from the provided one. I’ll dig up the font details once the lights and tree are up :-). I had tried a couple of free OFT fonts before finding one these poor tired eyes of mine could read!

The command takes the location in on the screen to start ‘printing’ at so my routine handles left / centre / right justification and multiple lines before calling the Pimoroni code.


OK, thats kind of what I thought it did. I was grasping at straws a bit to be honest.


The font rasterisation is done with PIL (Python Image Library) and could be a bug in the library- but font rendering is such a complete minefield I wouldn’t even know where to begin.There may be a font/size combination that doesn’t do this.


Thank you for that - the font itself looks fine on the site Fontspace so I’ll have a play and see what I can find.

I’ll also have a hunt for a newer version of PIL and see what that breaks :-) Well its been a couple of weeks since I broke Linux on a Pi…


Well its been a week or two and I’ve just got back to this and trashed the Pi! Shame as I found a font (TruenoSBd) that is fine, if a little bold.

Tried updating PIL and / or Pillow but the software kept saying I needed to install Pillow via SUDO pip. When I tried this pip reported Pillow was already installed!

Odd that I was running Python 3 but needed to install a 2.7 library and in the end I could not get either PIL or Pillow to re-install either as a normal user or sudo at either 2.7 or 3. Main issue seemed to be the jpeg headers / library missing and despite installing them they where never found.

So back to Etcher I go. More news as I make progress.


Life gets worse!

Hit by Apples auto quote correction - ended up spending 3 hours trying to get the headless Pi to connect to the network till I spotted the quotes being wrong! You name it I tried it up to and including a new DCHP server…

Now I find that the GitHub repo instructions assume you are using Python 2 and not Python 3 despite the examples being in 3
Then I find the format of the set up has changed
Then I find the rotate has gone
Then I find the rectangle has gone

If this is the example of LINUX and its support, I’m going to try Arduino boards.

I’ve now got to use an outdated library that may not be supported anymore as a larger device has taken half the functions away else I junk the whole project code and start again - not a happy bunny to say the least.


All of the functions removed from the library still exist- they are just part of PIL/Pillow and exist in either the ImageDraw or Image classes. One of the key reasons for dropping these from the library was to avoid exactly the problem you’re having now- the assumption that rotate and rectangle are features of Inky pHAT specifically and not something you can use everywhere with a standard drawing library.

This is to drive home that Inky isnt’ special- it does nothing but take an image and display it on the screen- and that the drawing library - PIL/Pillow - is responsible for all the clever stuff- teaching a portable skill you can use with other libraries, boards or projects. I’m sorry you got caught up in this - uh - I guess idealogical shift? At least your experiences - negative though they are - suggest it was the right choice!

Anyway moving forward you should perform all your image operations in a PIL-native way- our new inky repository has all of the old examples ported to this approach.

IE: If you want to rotate the image, PIL’s got you covered: image = image.rotate(180)

And if you want to draw a rectangle:

from PIL import Image, ImageDraw
image ="P", (212, 104))  # Create an image to fit on Inky pHAT's display
draw = ImageDraw.Draw(image)        # Create a new Draw instance to get our drawing functions
draw.rectangle((x1, y1, x2, y2), fill=0, outline=1)

And then inky just accepts set_image to display the finished product.


And this sums up the problem perfectly:

One of the key reasons for dropping these from the library was to avoid exactly the problem you’re having now- the assumption that rotate and rectangle are features of Inky pHAT specifically and not something you can use everywhere with a standard drawing library.

A library is provided with examples that show functions that work and then disappear in the next version. The documentation provided does not explain these have gone or are part of another lower level library and its up to the user to track all of these!

I come from a corporate environment with clearly defined and documented APIs supporting multiple hundreds of users across countries and continents with formal testing and change control processes (and yes we still make mistakes and I have spent a weekend rolling back a large change before now) and maybe expect too much of this ‘open source’ development methodology?

Thank you for clarifying this though - I think from a project point of view we need to spend more time understanding code change impact and how we can lock the code down - maybe some ‘re-skilling / up-s killing’ is to be built in to the timeframe :-)