Updated readme, realized I need to do a font sanity check...

master
Steven Saus 3 years ago
parent 794dc16ffd
commit b7f1c2a961
  1. 89
      weather_image/README.md
  2. BIN
      weather_image/out_000.jpg
  3. BIN
      weather_image/out_001.jpg
  4. BIN
      weather_image/out_002.jpg
  5. BIN
      weather_image/output.jpg
  6. 7
      weather_image/weather_image.sh
  7. BIN
      weather_image/xscreensaver_setup.png

@ -0,0 +1,89 @@
# weather_image.sh
Uses a compatible variant of [weather.sh](https://uriel1998.github.io/weather.sh/) in order to create an image suitable
for backgrounds and screensavers with the time and weather embedded in it.
![Output example](https://raw.githubusercontent.com/uriel1998/weather.sh/master/example_output.png "Example output")
## Contents
1. [About](#1-about)
2. [License](#2-license)
3. [Prerequisites](#3-prerequisites)
4. [How to use](#4-how-to-use)
5. [TODO](#5-todo)
***
## 1. About
I have several applications that show screensavers of images, optionally from a
directory. Which is great. But that doesn't have things like the time or
current weather on them.
The ones I'd seen *with* that functionality had a tendency to crash after a
couple of hours.
So building off the weather.sh script, I've hacked together a script that will
embed the data onto a single image or a series of images. After configuring
your screensaver (or whatever) to source images from a specific directory,
![Configure Xscreensaver Example]( "Example of configuring Xscreensaver")
then you run `weather_image.sh` so that it outputs images to that directory
every so often (like, uh, once a minute) and overwrites the older ones. You
can source *your* images from a directory, a single file, or have it pull
random images from [pixabay](pixabay.com). This program uses the cached data
from `weather.sh` to minimize API calls if you're running both.
## 2. License
This project is licensed under the MIT license. For the full license, see `LICENSE`.
## 3. Prerequisites
* All the prereqs for [weather.sh](https://uriel1998.github.io/weather.sh/), as well as...
* `shuf` to shuffle output. Can be found in the `coreutils` package on major
Linux distributions.
* `imagemagick` image manipulation. Can be found in the `imagemagick-*`
package on major Linux distributions.
* `wget` command-line tool for getting data using HTTP protocol. cURL can be
found in the `wget` package on major Linux distributions.
## 4. How to use
Run `weather_images.sh` or `forecast.sh` with the appropriate commandline
switches (below).
### weather_sh.rc
If you already have a working installation of [weather.sh](https://uriel1998.github.io/weather.sh/),
then you can skip this section.
Copy (and edit, as appropriate) the `weather_sh.rc` file to `$HOME\.config\weather_sh.rc`.
* The first line is the OpenWeatherMap API key
* The second line is your default location. (See note below)
* The third line is your default degree character (either `c` or `f`)
* The fourth line is True or False depending on whether or not you want icons displayed for the weather.
### Command-line options
By default, `weather_image.sh` sources all images from pixabay and will output
files to `out.jpg` in the *script directory*.
`weather_image.sh` can be started with the following command line
options:
* `-b` : add blur
* `-r` : occasionally mix in random image from pixabay (hardcoded to every third for now)
* `-help` or `-?` : show help text
* `-n ###` : the number of output images to make (autonumbered)
* `-d [directory]` : image directory to choose from
* `-i [file]` : specific image file to use
* `-h ###` : height if sourced from pixabay
* `-w ###` : height if sourced from pixabay
* `-o [full path]` : specify output file
## 5. Todo
* Options for how often images are sourced from the internet
* Variable for font, perhaps? It's on line 157...

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

@ -44,6 +44,9 @@ print_help (){
}
#TODO - check fonts
# fc-list | grep -i "nimbus"
while [ $# -gt 0 ]; do
option="$1"
case $option
@ -139,7 +142,7 @@ main() {
ImageWidth=$(echo "${ImageSize}" | awk -F 'x' '{print $1}')
ImageHeight=$(echo "${ImageSize}" | awk -F 'x' '{print $2}')
# because otherwise the text gets squashed
if [ "$ImageWidth" -le 1300 ];then
if [ "$ImageWidth" -le 1366 ];then
TextWidth=$(( "$ImageWidth" / 3 ))
TextWidth=$(( "$TextWidth" * 2 ))
else
@ -154,7 +157,7 @@ main() {
IconData=$(echo "$DataInfo" | head -1)
TextData=$(echo "$DataInfo" | tail -6)
cp "${SCRIPT_DIR}"/icons/"$IconData".png "${TempDir}"/WeatherIcon.png
/usr/bin/convert -background none -fill white -stroke black -strokewidth 2 -gravity Southeast -font Abydos -size "$TextWidth"x"$TextHeight" \
/usr/bin/convert -background none -fill white -stroke black -strokewidth 2 -gravity Southeast -font Interstate -size "$TextWidth"x"$TextHeight" \
caption:"$TextData" \
-gravity Southwest \
"${TempDir}"/TextImage.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Loading…
Cancel
Save