> ## Content Index
> Fetch the complete content index at: https://itsfoss.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Create Fun Word Cloud Images Easily in Linux Terminal
- URL: https://itsfoss.com/wordcloud/
- Published: 2024-10-08T02:19:58.000Z
- Updated: 2024-10-08T05:05:55.000Z
- Description: Create a random word cloud image in the Linux terminal with this Python tool.
- Author: Sreenath
- Tags: CLI Tools

Did you see cool wallpapers like the one below on communities and wallpaper websites?

![Sample wordcloud wallpaper](https://itsfoss.com/content/images/2024/09/transperant.png)

Sample wordcloud wallpaper

I am sure many of you have seen such wallpapers. 

In this tutorial, I will show how you can make such wallpapers and images in a very short time. Trust me, you don't need to be a Photoshop or GIMP Pro to do this!

## Wordcloud, the wordcloud generator

[Wordcloud](https://github.com/amueller/word%5Fcloud?ref=itsfoss.com) is a Python program for creating word cloud images. The project has been there for a long time and has been used in many other projects as dependencies.

Thanks to the developers of wordcloud, we can now generate our own images.

[Wordcloud](https://amueller.github.io/word%5Fcloud/?ref=itsfoss.com)

By the way, if you are [new to the Linux terminal and command line](https://itsfoss.com/linux-terminal-basics/), check out our tutorial series which is written for the absolute beginners.

[Linux Command Line Introduction \[Free Course\]Want to know the basics of the Linux command line? Here’s a tutorial series with a hands-on approach.![](https://itsfoss.com/content/images/icon/android-chrome-192x192-46.png)It's FOSSAbhishek Prakash![](https://itsfoss.com/content/images/thumbnail/getting-started-with-linux-terminal.webp)](https://itsfoss.com/linux-terminal-basics/)

## Install wordcloud

Wordcloud is available in default repositories of Ubuntu. To install it, use the command:

```
sudo apt install python3-wordcloud

```

🚧

This will install several packages with some considerable disk spaces. So, keep caution, a large download size is expected.

Wordcloud is available to install as a Python package. So you can install it either [using pip](https://itsfoss.com/install-pip-ubuntu/) or pipx. I prefer pipx to avoid some [possible headaches](https://itsfoss.com/externally-managed-environment/). Once [pipx is installed](https://itsfoss.com/install-pipx-ubuntu/), install wordcloud using the command:

```shell
pipx install wordcloud

```

That's it. You have installed wordcloud, and it can be used with the command `wordcloud_cli`.

📋

Either way, ensure that matplotlib, pillow, and numpy are installed. These are also available in the Ubuntu repos by the names `python3-matplotlib`, and `python3-numpy`.

## Using wordcloud

Wordcloud offers several options and features that you can use to create unique images. Let's see some cool items!

📋

Before creating all wordcloud images, you need to have some collection of words. In usual case, you can store words in a text file. Other cases will be described below.

### Create a simple image with words

Let's say you have 100 random words saved to a file called `words.txt`. To create an image from this file, use the command:

```shell
wordcloud_cli --text </path/to/words.txt> --imagefile wallpaper.png

```

This will create a 400×200 PNG with the given words.

![A sample wallpaper image created using wordcloud utility.](https://itsfoss.com/content/images/2024/09/wallpaper-1.png)

Default Wordcloud Image

### Create an image with custom dimensions

Now, imagine you have created a text file with hundreds of words using ChatGPT or some AI clients. In this case, a higher resolution image will do better. Let's see how to create a bigger image!

```
wordcloud_cli --text </path/to/words.txt> --width 1920 --height 1080 --imagefile highres.png

```

Now, it will create a high-resolution image (1920×1080 in this case).

### Use a custom font

By default, wordcloud uses DroidSansMono font. If you need to create an image with a custom font, use the `--fontfile` option.

📋

You should specify the font file location to the `--fontfile` option. So you should have the required file in hand.

I am going to use the Comic Neue font to create the image. You can download fonts from [Google Fonts](https://fonts.google.com/?ref=itsfoss.com) website.

![Download Comic Neue font from Google fonts website.](https://itsfoss.com/content/images/2024/09/download-a-font-file-from-google-fonts.png)

Download a Font

Extract the file and make the particular font file in an easily accessible location.

Now, run the command:

```
wordcloud_cli --text </path/to/words.txt> --width 800 --height 400 --fontfile </path/to/font/file> --imagefile customfont.png

```

Now, you have a wordcloud image with a custom font!

![Wordcloud with custom font applied.](https://itsfoss.com/content/images/2024/09/customfont.png)

Custom Font

### Custom background color

Not interested in the black background? Don't worry, you can apply a different color.

📋

Wordcloud supports several color specifications. You can [check here](https://pillow.readthedocs.io/en/stable/reference/ImageColor.html?ref=itsfoss.com) to know which format of colors will work, and use accordingly.

I am using a Nord type background color, so use the command:

```
wordcloud_cli --text </path/to/words.txt> --background '#313744' --imagefile nord-background.png

```

![Apply a nord background color to wordcloud image.](https://itsfoss.com/content/images/2024/09/newbackgroundcolor.png)

New background color

### Work with mask images

If you want to print images inside a particular frame, you can do that in wordcloud as well.

First, create a black image of the frame that you want to use. Here, I am using a black penguin image as the frame.

![Black penguin frame to work as a mask.](https://itsfoss.com/content/images/2024/09/penguin-mask.png)

Penguin Frame

Now, use the `--mask` option to get the masked image.

```
wordcloud_cli --text </path/to/words.txt> --mask </path/to/mask/image> --imagefile maskedimage.png

```

📋

Remember to make the mask image as wide as the required final image resolution.

![Masked image is used to create wordcloud.](https://itsfoss.com/content/images/2024/09/maskedimage-final.png)

Masked Image wordcloud

#### Use prebuilt examples

The project page has several examples available. Click the button below to check those.

[Check Examples](https://amueller.github.io/word%5Fcloud/auto%5Fexamples/index.html?ref=itsfoss.com)

Here, you can click on a particular design and download the corresponding Python script.

Once the script is downloaded, you can rename your words file as mentioned in the script. If you are using the mask, rename the mask file also according to the script.

For example, I am using [this example](https://amueller.github.io/word%5Fcloud/auto%5Fexamples/masked.html?ref=itsfoss.com#sphx-glr-auto-examples-masked-py), where the words file is called `alice.txt` and the mask file is called `alice_mask.png`. So, I will rename my *words.txt* as *alice.txt* and mask image as *alice\_mask.png*. This way it is easier than renaming variables and items inside the script.

Now, I will use the command:

```
python3 masked.py

```

This will create an image called *alice.png*, the result I require.

![Creating images using prebuilt scripts.](https://itsfoss.com/content/images/2024/09/using-prebuilt-script.png)

Using prebuilt scripts

## Possible image ideas

You can create several images unique to your system. Let's see some examples:

### Installed packages

If you are using Debian/Ubuntu-based distributions, you can list the installed packages of your system and then make a text file of it.

```shell
dpkg --get-selections > packages.txt

```

Now, use this `packages.txt` to create a wallpaper that lists all the package names you installed on your system.

### Your bash command history ;)

If you are ok with exposing your bash history, save all the commands to a text file and then use this text to create an image.

```
history > my_bash_history.txt

```

### Other ideas

- You can list the names of some programs that you cannot forget and then use it to create a wallpaper.
- Use AI tools to create random word lists.
- All Linux distro names.

## Wrapping Up

Even though wordcloud offers command line options for many tasks, this is used as a dependency for other Python projects. For that purpose, there are [API references](https://amueller.github.io/word%5Fcloud/references.html?ref=itsfoss.com) you can check.

One such project is [Process-wallpaper](https://github.com/anirudhajith/process-wallpaper?ref=itsfoss.com). The project itself is a bit old, so it won't automatically apply wallpaper. But it does work creating a wallpaper based on the most resource-intensive processes presently running on your system.

On a similar note, you may want to use this handy CLI tool to [convert images into ASCII art](https://itsfoss.com/ascii-image-converter/):

[Convert Images to ASCII Art in Linux TerminalWant some fun in the Linux terminal? How about converting a regular image into ASCII art? This tool lets you convert any image into ASCII art.![](https://itsfoss.com/content/images/icon/android-chrome-192x192-32.png)It's FOSSAbhishek Prakash![](https://itsfoss.com/content/images/thumbnail/convert-ascii-image-linux.png)](https://itsfoss.com/ascii-image-converter/)