2016-08-23 03:50:25 +00:00
|
|
|
Utilities
|
|
|
|
|
=========
|
|
|
|
|
|
|
|
|
|
This contains useful utilities that might be directly useful without having
|
|
|
|
|
to write any code.
|
|
|
|
|
|
2016-08-20 16:57:27 +00:00
|
|
|
### Image Viewer ###
|
|
|
|
|
|
|
|
|
|
The image viewer reads all kinds of image formats, including animated gifs.
|
2016-08-23 03:50:25 +00:00
|
|
|
To compile, you first need to install the GraphicsMagick dependencies first:
|
2016-08-20 16:57:27 +00:00
|
|
|
|
2016-08-23 03:50:25 +00:00
|
|
|
```
|
|
|
|
|
sudo apt-get update
|
|
|
|
|
sudo apt-get install libgraphicsmagick++-dev libwebp-dev -y
|
|
|
|
|
make led-image-viewer
|
|
|
|
|
```
|
2016-08-20 16:57:27 +00:00
|
|
|
|
2016-08-23 06:08:25 +00:00
|
|
|
The resulting binary has a couple of flags.
|
|
|
|
|
```
|
2016-12-09 04:24:33 +00:00
|
|
|
usage: ./led-image-viewer [options] <image> [option] [<image> ...]
|
2016-08-23 06:08:25 +00:00
|
|
|
Options:
|
2016-08-24 03:45:48 +00:00
|
|
|
-C : Center images.
|
2016-08-23 06:08:25 +00:00
|
|
|
-w<seconds> : If multiple images given: Wait time between in seconds (default: 1.5).
|
|
|
|
|
-f : Forever cycle through the list of files on the command line.
|
|
|
|
|
-t<seconds> : For gif animations: stop after this time.
|
|
|
|
|
-l<loop-count> : For gif animations: number of loops through a full cycle.
|
2016-12-09 04:24:33 +00:00
|
|
|
-s : If multiple images are given: shuffle.
|
2016-09-05 03:50:23 +00:00
|
|
|
-L : Large display, in which each chain is 'folded down'
|
|
|
|
|
in the middle in an U-arrangement to get more vertical space.
|
|
|
|
|
-R<angle> : Rotate output; steps of 90 degrees
|
2016-08-23 06:08:25 +00:00
|
|
|
|
|
|
|
|
General LED matrix options:
|
2016-09-17 02:02:53 +00:00
|
|
|
--led-gpio-mapping=<name> : Name of GPIO mapping used. Default "regular"
|
2016-08-23 06:08:25 +00:00
|
|
|
--led-rows=<rows> : Panel rows. 8, 16, 32 or 64. (Default: 32).
|
|
|
|
|
--led-chain=<chained> : Number of daisy-chained panels. (Default: 1).
|
|
|
|
|
--led-parallel=<parallel> : For A/B+ models or RPi2,3b: parallel chains. range=1..3 (Default: 1).
|
2016-09-05 03:50:23 +00:00
|
|
|
--led-pwm-bits=<1..11> : PWM bits (Default: 11).
|
|
|
|
|
--led-brightness=<percent>: Brightness in percent (Default: 100).
|
|
|
|
|
--led-scan-mode=<0..1> : 0 = progressive; 1 = interlaced (Default: 0).
|
|
|
|
|
--led-show-refresh : Show refresh rate.
|
|
|
|
|
--led-inverse : Switch if your matrix has inverse colors on.
|
|
|
|
|
--led-swap-green-blue : Switch if your matrix has green/blue swapped on.
|
|
|
|
|
--led-pwm-lsb-nanoseconds : PWM Nanoseconds for LSB (Default: 130)
|
|
|
|
|
--led-no-hardware-pulse : Don't use hardware pin-pulse generation.
|
|
|
|
|
--led-slowdown-gpio=<0..2>: Slowdown GPIO. Needed for faster Pis and/or slower panels (Default: 1).
|
|
|
|
|
--led-daemon : Make the process run in the background as daemon.
|
|
|
|
|
--led-no-drop-privs : Don't drop privileges from 'root' after initializing the hardware.
|
2016-12-09 04:24:33 +00:00
|
|
|
|
2016-08-23 15:54:50 +00:00
|
|
|
Switch time between files: -w for static images; -t/-l for animations
|
2016-12-09 04:24:33 +00:00
|
|
|
Animated gifs: If both -l and -t are given, whatever finishes first determines duration.
|
|
|
|
|
|
|
|
|
|
The -w, -t and -l options apply to the following images until a new instance of one of these options is seen.
|
|
|
|
|
So you can choose different durations for different images.
|
2016-08-23 06:08:25 +00:00
|
|
|
```
|
|
|
|
|
|
2016-08-20 16:57:27 +00:00
|
|
|
Then, you can run it with any common image format, including animated gifs:
|
|
|
|
|
|
2016-08-23 06:08:25 +00:00
|
|
|
Examples:
|
|
|
|
|
```bash
|
|
|
|
|
sudo ./led-image-viewer some-image.jpg # Display an image.
|
|
|
|
|
sudo ./led-image-viewer animated.gif # Show an animated gif
|
|
|
|
|
sudo ./led-image-viewer -t5 animated.gif # Show an animated gif for 5 seconds
|
|
|
|
|
sudo ./led-image-viewer -l2 animated.gif # Show an animated gif for 2 loops
|
|
|
|
|
|
2016-08-23 15:54:50 +00:00
|
|
|
sudo ./led-image-viewer -w3 foo.jpg bar.png # show two images, wait 3 seconds between. Stop.
|
2016-12-09 04:24:33 +00:00
|
|
|
sudo ./led-image-viewer -w3 foo.jpg -w2 bar.png baz.png # show images, wait 3 seconds after the first, 2 seconds after the second and third. Stop.
|
2016-08-23 15:54:50 +00:00
|
|
|
sudo ./led-image-viewer -f -w3 foo.jpg bar.png # show images, wait 3sec between, go back and loop forever
|
2016-08-23 06:08:25 +00:00
|
|
|
|
|
|
|
|
sudo ./led-image-viewer -f -w3 *.png *.jpg # Loop forever through a list of images
|
|
|
|
|
|
2016-12-09 04:24:33 +00:00
|
|
|
sudo ./led-image-viewer -f -s *.png # Loop forever but randomize (shuffle) each round.
|
|
|
|
|
|
2016-08-23 06:08:25 +00:00
|
|
|
# Show image.png and animated.gif in a loop. Show the static image for 3 seconds
|
|
|
|
|
# while the animation is shown for 5 seconds (-t takes precendence for animated
|
|
|
|
|
# images over -w)
|
|
|
|
|
sudo ./led-image-viewer -f -w3 -t5 image.png animated.gif
|
|
|
|
|
```
|
2016-08-20 16:57:27 +00:00
|
|
|
|
|
|
|
|
It also supports the standard options to specify the connected
|
2016-08-23 15:54:50 +00:00
|
|
|
displays (e.g. `--led-rows`, `--led-chain`, `--led-parallel` and
|
2016-08-24 02:41:49 +00:00
|
|
|
[all other led-libray flags](../README.md#changing-parameters-via-command-line-flags))
|