Skip to content

Latest commit

 

History

History
64 lines (52 loc) · 2.21 KB

File metadata and controls

64 lines (52 loc) · 2.21 KB

Creating images:

  1. On Windows PC install Python 3.91 or later, find it here: https://www.python.org/downloads/
  2. Create an folder e.g. C:\temp\images\
  3. Copy your source .JPG images to the folder e.g. myimage.jpg
  4. Copy imgconvert.py located in this scripts folder to c:\temp\images\
  5. Start a Windows cmd prompt, and chage directory to the folder:
    > cd C:\temp\images\
    
  6. To create an image for display, enter this at the command prompt:
    > python imgconvert.py -i myimage.jpg - n myimage -o myimage.h
    
  7. The image file is now created, move the myimage.h file into your sketch folder and include the file in your code like this
    #include "myimage.h"
    
  8. Draw the image like this:
    DrawMyImage(x, y);
    
    void DrawMyImage(int x, int y) {   
        Rect_t area = { .x = x, .y = y, .width = 100, .height = 100 };   
        epd_draw_grayscale_image(area, (uint8_t *) myimage_data); 
    }
    

Creating fonts:

  1. On Windows PC install Python 3.91 or later, find it here: https://www.python.org/downloads/

  2. Find a suitable Font Family e.g google opensans.ttf
    https://fonts.google.com/specimen/Open+Sans

  3. Download the Font Family file

  4. Create an accessible folder e.g. C:\temp\fonts\

  5. Unzip all *.ttf files to the folder. It now has all types of font files.ttf of the chosen font, like:
    OpenSans-Bold.ttf
    OpenSans-BoldItalic.ttf
    OpenSans-Regular.ttf
    ...

  6. Copy fontconvert.py located in this scripts folder to c:\temp\fonts\

  7. Start a Windows cmd prompt, and chage directory to the folder:

    > cd C:\temp\fonts\
    
  8. Create fonts you need.

    To create a Regular 10-point font, enter this at the command prompt:  
    > python fontconvert.py OpenSans12 12 OpenSans-Regular.ttf > opensans12.h
    
    To create a Bold 10-point font, enter this at the command prompt:  
    > python fontconvert.py OpenSans10B 10 OpenSans-Bold.ttf > opensans10b.h
    
  9. The font files are now created. Move the opensansNNx.h file into your sketch folder and include the file in your code like this

    #include "opensans10b.h"