Avatar Hund

Linux, plaintext & minimalism

June 3, 2019

How to get a near real-time picture of Earth as your desktop wallpaper

If you like me, enjoy photos of the Earth, you may also appreciate the ability to set a near real-time photo of it as your desktop wallpaper. It’s actually only delayed for up to 10 minutes!

A screenshot of my desktop with a picture of the Earth as the wallpaper
The screenshot is compressed, the actuall picture of earth is in very high quality.

This is made possible with a Python 3 script called himawaripy. It’s a script that downloads a fresh picture of the Earth that’s taken with the Japanese weather satellite Himawari 8.

You can choose between different resolutions which are referred to as quality. You can choose between quality 4, 8, 16 and 20. The application doesn’t come with a manual and the flag --help doesn’t say anything about the quality options.

I tried them all and this is what I ended up with when about 90% of the Earth was visible:

Quality Resolution (pixels) File size
4 2200 x 2200 5.83 MB
8 4400 x 4400 21.8 MB
16 8800 x 8800 79 MB
20 11000 x 11000 126 MB

Be aware that the quality 20 eats a lot of memory when it processes the image! It used about 650 MiB of RAM for me. With quality 4 it only used about 40 MiB of RAM.

Installation

The recommended (or at least the easiest) way of installing it is via the Python package manager called pip:

$ pip install --user himawaripy

If you don’t have pip you need to install it. On systems like Gentoo and Arch Linux the package is called python-pip, while on Debian and Debian based systems it’s called python3-pip.

Usage

The default usage is:

$ himawaripy -l <quality> --auto-offset

The flag --auto-offset determines the timezone automatically. You can manually specify the UTC offset in hours yourself with the flag -o, --offfset <-12 to +10>.

They only specify some common desktop environments as compatible, but it just fell back to feh for me who doesn’t use a desktop environment.

If you only want to download the image and not set is as a wallpaper you can add the flag --dont-change:

$ himawaripy -l <quality> --dont-change

This is handy if you want to use the image for something else or just want to set it as a wallpaper yourself like I do.

How I use it

By default some of the Earth was hidden behind my panel. I didn’t liked it so I wrote a little script that adds a black border to the image and then sets that image as the wallpaper.

#!/bin/bash

dir="$HOME/.cache/himawaripy"

himawaripy -l 4 --auto-offset --dont-change
convert -border 64x64 -bordercolor black $dir/himawari*.png $dir/output.png
feh --bg-max $dir/output.png

I then added a cronjob that runs every 60 minutes to refresh the image:

*/60 * * * * $HOME/Scripts/space_wallpaper.sh

Feedback

I don't have a commenting system on my blog because I haven't found one that I like. All feedback and hellos can be done via either e-mail, XMPP or Mastodon.