Compare commits
2 Commits
bb24beb9e3
...
14a61e97b8
Author | SHA1 | Date |
---|---|---|
interfisch | 14a61e97b8 | |
interfisch | 15e21f74cc |
Binary file not shown.
After Width: | Height: | Size: 519 B |
|
@ -3,6 +3,9 @@ import math
|
||||||
import argparse
|
import argparse
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
|
#for a 2-bit dithered grayscale image use:
|
||||||
|
# convert testimage.png -dither FloydSteinberg -define dither:diffusion-amount=85% -remap 4gray.png -compress RLE -define png:color-type=6 output.png
|
||||||
|
|
||||||
|
|
||||||
def swapBits(number, nbits):
|
def swapBits(number, nbits):
|
||||||
if nbits==2:
|
if nbits==2:
|
||||||
|
|
2006
src/ImageData.cpp
2006
src/ImageData.cpp
File diff suppressed because it is too large
Load Diff
20
src/main.cpp
20
src/main.cpp
|
@ -1,6 +1,22 @@
|
||||||
// Library, connections and info from: https://www.waveshare.com/wiki/E-Paper_ESP32_Driver_Board#Resource
|
// Library, connections and info from: https://www.waveshare.com/wiki/E-Paper_ESP32_Driver_Board#Resource
|
||||||
// Display: https://www.waveshare.com/product/4.2inch-e-paper.htm
|
// Display: https://www.waveshare.com/product/4.2inch-e-paper.htm
|
||||||
|
|
||||||
|
|
||||||
|
//Convert to 1 bit grayscale:
|
||||||
|
//maybe dither before
|
||||||
|
// convert image to array:
|
||||||
|
// python3 img2array.py -i image.png
|
||||||
|
|
||||||
|
//Convert to 2 bit grayscale dithered:
|
||||||
|
// first convert image to dithered 2 bit image:
|
||||||
|
// convert testimage.png -dither FloydSteinberg -define dither:diffusion-amount=85% -remap 4gray.png -compress RLE -define png:color-type=6 output.png
|
||||||
|
|
||||||
|
// then image to array:
|
||||||
|
// python3 img2array.py --bitdepth 2 --lsbfirst --colorlsbfirst testimage.png
|
||||||
|
|
||||||
|
// then copy generated ...png.txt content to ImageData.cpp
|
||||||
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "DEV_Config.h"
|
#include "DEV_Config.h"
|
||||||
#include "EPD.h"
|
#include "EPD.h"
|
||||||
|
@ -38,7 +54,7 @@ void setup()
|
||||||
printf("show image for array\r\n");
|
printf("show image for array\r\n");
|
||||||
Paint_SelectImage(BWImage);
|
Paint_SelectImage(BWImage);
|
||||||
Paint_Clear(WHITE);
|
Paint_Clear(WHITE);
|
||||||
Paint_DrawBitMap(gImage_4in2); //to convert image use: python3 img2array.py -i image.png
|
Paint_DrawBitMap(gImage_4in2);
|
||||||
EPD_4IN2_Display(BWImage);
|
EPD_4IN2_Display(BWImage);
|
||||||
|
|
||||||
free(BWImage);
|
free(BWImage);
|
||||||
|
@ -64,7 +80,7 @@ void setup()
|
||||||
Paint_SelectImage(GSImage);
|
Paint_SelectImage(GSImage);
|
||||||
Paint_SetScale(4);
|
Paint_SetScale(4);
|
||||||
|
|
||||||
Paint_DrawBitMap(gImage_4in2);
|
Paint_DrawBitMap(gImage_4in2);
|
||||||
EPD_4IN2_4GrayDisplay(GSImage);
|
EPD_4IN2_4GrayDisplay(GSImage);
|
||||||
|
|
||||||
DEV_Delay_ms(10000);
|
DEV_Delay_ms(10000);
|
||||||
|
|
Loading…
Reference in New Issue