Manage cookies

We use cookies to improve our services. Read more about how we use cookies and how you can refuse them.

The necessary cookies help to make the website work properly.

Anonymous statistical cookies help to understand how visitors use the website.

  • Raspberry Pi
    3 min | 21238

    #Raspberry Pi: Displaying images on an E-Ink screen

    Raspberry Pi | 3 min | 21238


    Last week, I published an article about the Raspberry Pi and an e-ink display:

    This time, this tutorial is about processing and displaying images on the 7.5" e-ink screen as shown in Fig. 1b.

    Waveshare® 7.5" E-ink Screen connected to a Raspberry Pi
    Fig. 1a: E-ink Screen connected to a RPi
    running ePaperWidgets
    Fig. 1b: Banggood's 13th anniversary
    original image here

    Hardware & Software

    You find here a list of hardware and software that you could use for this tutorial:

    DIY

    The 7.5" Waveshare E-Ink screen has only 3 colors (red, black and white). Thus, to display an image on the screen, you need to remap it from a RGB-color scheme to a 3-color scheme. This can be done easily using ImageMagick. Then, download the application, intall it and use the following code to convert the image:

    # Create 3 color palette:
    magick xc:red xc:white xc:black +append palette.gif
    # Image dithering using Floyd-Steinberg:
    magick input_image.png -remap palette.gif result_image.png

    The first line create a 3-color palette, and the second line remap the input_image.png using the 3-color palette and save the results in a new image result_image.png. Note that the image input_image.png should have the size of your display. In my case it has 640 x 384 px compatible with the 7.5" Waveshare E-ink display. The result_image.png looks like Fig. 2b

    input_image.pngresult_image.png
    Fig. 2a: Banggood Anniversary Image
    Original Image
    Fig. 2b: Banggood Anniversary Image
    in Red-Black and White

    The display code needs two two BMP images: the first one describes the pixels that will be black, and the second one for the pixels that are going to be red. Thus, you need to split the result_image.png image into two image (red pixels and black pixels). To do that, you can use the split_image.py file that I've included in the Github repository. The resulting images look like Fig. 3.

    layer_0.bmplayer_1.bmp
    Fig. 3a: Black Color Layer of the
    Banggood Anniversary Image
    Fig. 3a: Red Color Layer of the
    Banggood Anniversary Image

    Then, upload the image2eink folder from the repository to the Raspberry Pi (or clone the complete repository), rename the images (layer_x.bmp) to 7in5b-b.bmp (black) and 7in5b-r.bmp (red) and upload them to the folder pic inside image2eink. The file main.py will read those images and send the pixels to the display. But first you need to active the SPI interface of the Raspberry Pi using raspi-config and then, you need to install the following dependencies:

    sudo apt-get install python3-pip
    pip3 install Pillow
    pip3 install spidev

    Finally, run the main.py file typing: python3 main.py. The results are shown in Fig. 1b.

    Last but not least, check this news about Banggood:

    and participate in the official activities as described below:

    Banggood 13th Anniversary

    The preview stage of Banggood’s 13th Anniversary Sale has officially begun with a cascade of activities and special deals from our partner brands such as Eachine, BlitzWolf, Sonoff, Digoo, Bakeey, and Geekcreit. I would like to invite the fans and customers to guess the meaning behind the 13th anniversary logo (see Fig. 1b or 2a) in the comments section below (and also in your social media - ref. this article too, if you want to... :) ), adding the hashtag #banggood13.

    Any creative answers will count. Banggood will randomly select 3 lucky winners who will receive prizes. The first prize is a Sterling engine from Eachine, the 2nd a pair of wireless earphones from BlitzWolf and the 3rd an IP Cam from Digoo.

    Winners will be announced on September 12th.

    You can find more information using this link: 13th Anniversary Shopping Guide.


    Comments

    Sridhar Rajagopal 04.09.2021

    Hi there! Thanks for the useful tutorial! I couldn't find your split_image.py - can you give a link to your github where it is located?

    Thanks! Sridhar

    Prashant 05.09.2021

    good job