Skip to content

Command line utility that converts images to a format used by my driver for Waveshare Pico e-Paper 3.7 display.

Notifications You must be signed in to change notification settings

phoreglad/epaper-img-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

img_to_py.py

This command line utility converts images to a format used by a driver for Waveshare Pico e-Paper 3.7 display.

Arguments

1. Positional arguments

  1. Path to the source image.
  2. Path to output file. This is an optional argument, if the target path is not provided the data will be saved to a file with the same name as source image with extension changed to .py.

2. Optional arguments

  • --mode, -m -- target image format. L1 (default) for black and white, L2 for 4 level grayscale.
  • --preview, -p -- show converted image preview.
  • --preview-only -- show converted image preview and exits without saving any data.
  • --dither, -d -- use dithering.
  • --width -- Set desired target image width.
  • --height -- Set desired target image width.

NOTE If only --width or --height is specified the resulting image will be scaled preserving aspect ratio. If both are specified the image will be scaled to exact dimensions.


  • --threshold, -t -- set threshold values for image conversion. Takes one value (v1) in L1 and three (v1, v2, v3) in L2 mode. Relation between threshold values and resulting colours are in the table below. This argument has to be used last. Default values: 63, 126, 189.
pixel value (px) result (L1) result (L2)
px < v1 black black
v1 <= px < v2 white dark gray
v3 <= px < v3 white light gray
px > v3 white white

Example use

Original image:

original

Black and white

py img_to_py.py test_img\IMG_0182.jpg

image

Black and white with dithering

py img_to_py.py -d test_img\IMG_0182.jpg

image

4 level grayscale

py img_to_py.py -m L2 test_img\IMG_0182.jpg

image

4 level grayscale with dithering

py img_to_py.py -m L2 -d test_img\IMG_0182.jpg

image


Displaying images

Example showing how to display images on the Pico e-Paper 3.7 display look here.

About

Command line utility that converts images to a format used by my driver for Waveshare Pico e-Paper 3.7 display.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages