How to install and use Gallery-DL on Linux?

How To Install Gallery DL On Linux

As the name suggests, Gallery-DL is a command line tool which can help you download Images from an Image hosting site such as Imgur or Pinterest, along with many other sites. It can also download images in bulk as well as collections. This is a cross-platform tool, which means you can install it on several operating systems, such as Windows, macOS as well as Linux based distros.

In this tutorial, we will learn how to install this command line tool on every major Linux distributions, as well as learn how to use and configure it for basic usage.

Installing Gallery-DL on Linux

As the package Gallery-dl is distributed via PyPI, it can be easily installed via pip. Just open a Terminal window, regardless of your distribution. Before you run the actual command that installs Gallery-DL on your PC, make sure to upgrade all the essential packages by typing:

python3 -m pip install --upgrade pip setuptools wheel
Upgrde Pip And Other Packages
Upgrde Pip And Other Packages

Finally, run the following command to install this command line tool:

python3 -m pip install -U gallery-dl
Installing Gallery Dl On Linux
Installing Gallery Dl On Linux

Alternatively, if you are using a distribution that features the Snap Package Manager such as Ubuntu, you can use the following command instead:

snap install gallery-dl

Using Gallery-DL to download Images

The syntax of this command line tool is as follows:

gallery-dl [OPTIONS]... URLS...

For example, we can run a help command to determine what options Gallery-DL has for us to use:

gallery-dl --help
You Can Access Further Details Using Help
You Can Access Further Details Using Help

For example, here, I’m downloading a random GIF from the Image hosting site ‘Imgur’:

galley-dl <URL>
Downloading A Random GIF From Imgur
Downloading A Random GIF From Imgur

You can get a list of supported sites from their official GitHub page.

Also, if any site has its images locked behind an authentication, then you can also use your username and password in the command. It should look something like this:

gallery-dl -g -u "<username>" -p "<password>" "https://twitter.com/i/web/status/604341487988576256"

This command can also be used to search remote resources for image URLs (for example sites like Pastebin etc) and download all the images listed there. You can use the command like this:

gallery-dl "r:https://pastebin.com/raw/FLwrCYsT"

Extra Configuration

It is not ideal for anyone to retype username and passwords every time they want to download images from a site. Therefore, we can simply create a configuration file on our PC which will store usernames and passwords for a specific site, and we can download images without hassle. On Linux, the configuration file can be stored in /etc/gallery-dl.conf or ${HOME}/.gallery-dl.conf. For example, you can store your credentials for Twitter like this:

{
    "extractor": {
        "twitter": {
            "username": "<username>",
            "password": "<password>"
        }
    }
}
Storing Credentials Of Twitter In The Config File
Storing Credentials Of Twitter In The Config File

Note that storing credentials of your social media platforms in this manner is not secure, and therefore it is recommended that you use a burner account for using the configuration file.

Apart from storing passwords, the config file can also store Cookies for sites which have implemented captchas. Also, this command line tool also supports authentication via OAuth for some websites including DeviantArt, Reddit and mastodon.

Wrapping Up

Gallery-DL is a simple and easy to use tool to download images from your favorite websites. It supports a lot of websites and also features support for OAuth and cookies, which makes the entire process of downloading Images seamless. We hope you were successfully able to install and run this tool on your PC with the help of this guide, if you have any doubts, please let us know in the comments below!

Keep in mind that Images on certain Image hosting site may have a license for reuse or commercial use, and therefore you should not just blindly use the downloaded media in your products or other commercial activities.