A terminal utility to sort image files based on their characteristics.

Overview

About

A terminal utility to sort image files based on their characteristics.

Motivation

This program was developed after I've realized that I had too many wallpapers, and too little time. Although there are more advanced programs with a wider range of features (e.g.: variety, hydrus) most of the times I just want to filter my wallpapers by resolution or ratio from my downloads to my wallpaper folder, without leaving my terminal.

As so this tool was born, a minimal solution, which is meant to be used in a terminal ecosystem with other common utilities found in Linux based OSs, to assist the user in filtering image files.

Installation

Dependencies

This program requires Python version 3 as well as the following packages:

These packages are automatically resolved by pip.

Stable version

Install this program directly from Pypi:

$ pip install imgsort

Development version

For the latests updates, install the program directly from the dev branch on this repository:

$ pip install -e git+https://github.com/jpmvferreira/imgsort.git@dev#egg=imgsort

If instead you want to make changes to the source code, then clone this repository locally and install it in editable mode:

$ git clone https://github.com/jpmvferreira/imgsort
$ pip install -e imgsort

Usage

Let us now see this program in action with a few examples. Remember that at any time the help dialog (-h or --help) is available to provide information regarding the available flags.

To tell if wallpaper1.jpg in your current working directory is 1920x1080, then using the -s or --size flag:

$ imgsort wallpaper1.jpg -s 1920x1080

If the file is 1920x1080 then it will print its name, otherwise, it will print nothing.

If instead you want to know if wallpaper1.jpg is 16:9, you can use the same flag with with a ':' instead of the 'x':

$ imgsort wallpaper1.jpg -s 16:9

This can also be used for several files, with different formats:

$ imgsort wallpaper1.jpg wallpaper2.png -s 1920x1080

Naturally you can make use of bash's features, for example the wildcard statement, to filter a set of files which match a given pattern, in this case all of the .jpg files in the current working directory:

$ imgsort *.jpg -s 1920x1080

This program also reads from STDIN, which means that you can create pipelines with it.

For example, if you wish to tell if all your wallpapers, located at ~/wallpapers and respective subfolders, are 1920x1080, then create the following pipeline with find:

$ find ~/wallpapers | imgsort -s 1920x1080

If you wish to filter out all the wallpapers that are not 1920x1080, then you can rely on the -o or --opposite flag, which prints the file name if it doesn't match the provided size:

$ find ~/wallpapers | imgsort -s 1920x1080 -o

You can keep on adding to this pipeline to apply further actions.

Let's say you're trying to move all of your 1920x1080 wallpapers from ~/wallpapers/unsorted to ~/wallpapers/fullhd. By using the pipeline created above, and using xargs to which converts content found in STDIN to command line arguments, we can move all of those files to their designated location:

$ find ~/wallpapers/unsorted | imgsort -s 1920x1080 | xargs -I '{}' mv {} ~/wallpapers/fullhd

If you want to be sure that the program isn't doing anything funny, which you should, use -v or --verbose to print the image resolution or ratio to STDERR, which shouldn't affect the pipeline.

Contributing

If you happen to find a bug, have a question or would like to suggest a feature or simply share some fancy terminal wizardry, feel free to open up an issue.

Release cycle

This is a (very) small project, however, I do like to keep things tidy. As such I made a release cycle which goes as follows.

The first version will be 1.0.0, which is released once I consider that the program is good enough, and all the following versions will have the format X.Y.Z.

Each time that there is an update which does not modify the program behavior (e.g.: documentation, packaging) it will increment Z (e.g.: 1.0.0 -> 1.0.1).

Each time that there is an update which modifies the program behavior (e.g.: adding features, fixing bugs) it will increment Y and reset Z (e.g.: 1.0.1 -> 1.1.0).

Each time that there is an update which is not backwards compatible (e.g.: removing features, fundamental change on how the program is used) it will increment X and reset both Y and Z (e.g.: 1.1.2 -> 2.0.0).

In this Github repository you will find branches for the stable version (master) and the development version (dev). All modifications are done in the development branch and, after being tested, are included in the stable version, with the appropriate version bump.

License

MIT

You might also like...
jenkins-tui is a terminal based user interface for Jenkins.

jenkins-tui 📦 jenkins-tui is a terminal based user interface for Jenkins. 🚧 ⚠️ This app is a prototype and in very early stages of development. Ther

term2048 is a terminal-based version of 2048.
term2048 is a terminal-based version of 2048.

term2048 is a terminal-based version of 2048.

A simple terminal-based localhost chat application written in python
A simple terminal-based localhost chat application written in python

Chat House A simple terminal-based localhost chat application written in python How to Use? Clone the repo git clone https://github.com/heksadecimal/c

TUIFIManager - A cross-platform terminal-based file manager
TUIFIManager - A cross-platform terminal-based file manager

TUIFI Manager A cross-platform terminal-based file manager (and component), mean

A python-based terminal application that displays current cryptocurrency prices
A python-based terminal application that displays current cryptocurrency prices

CryptoAssetPrices A python-based terminal application that displays current cryptocurrency prices. Covered Cryptocurrencies Bitcoin (BTC) Ethereum (ET

Convert ACSM files to DRM-free EPUB files with one command on Linux
Convert ACSM files to DRM-free EPUB files with one command on Linux

Knock Convert ACSM files to DRM-free EPUB files using one command. This software does not utilize Adobe Digital Editions nor Wine. It is completely fr

Library and command-line utility for rendering projects templates.
Library and command-line utility for rendering projects templates.

A library for rendering project templates. Works with local paths and git URLs. Your project can include any file and Copier can dynamically replace v

A command-line utility that creates projects from cookiecutters (project templates), e.g. Python package projects, VueJS projects.
A command-line utility that creates projects from cookiecutters (project templates), e.g. Python package projects, VueJS projects.

Cookiecutter A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python

A command line utility to export Google Keep notes to markdown.

Keep-Exporter A command line utility to export Google Keep notes to markdown files with metadata stored as a frontmatter header. Supports exporting: S

Owner
José Ferreira
MSc student in Astrophysics and Cosmology at Instituto de Astrofísica e Ciências do Espaço (IA), in Faculty of Sciences of the University of Lisbon (FCUL)
José Ferreira
py-image-dedup is a tool to sort out or remove duplicates within a photo library

py-image-dedup is a tool to sort out or remove duplicates within a photo library. Unlike most other solutions, py-image-dedup intentionally uses an approximate image comparison to also detect duplicates of images that slightly differ in resolution, color or other minor details.

Markus Ressel 96 Jan 2, 2023
Sink is a CLI tool that allows users to synchronize their local folders to their Google Drives. It is similar to the Git CLI and allows fast and reliable syncs with the drive.

Sink is a CLI synchronisation tool that enables a user to synchronise local system files and folders with their Google Drives. It follows a git C

Yash Thakre 16 May 29, 2022
ddgr is a cmdline utility to search DuckDuckGo (html version) from the terminal

ddgr is a cmdline utility to search DuckDuckGo (html version) from the terminal. While googler is extremely popular among cmdline users, in many forums the need of a similar utility for privacy-aware DuckDuckGo came up. DuckDuckGo Bangs are super-cool too! So here's ddgr for you!

Piña Colada 2.5k Dec 25, 2022
Gamestonk Terminal is an awesome stock and crypto market terminal

Gamestonk Terminal is an awesome stock and crypto market terminal. A FOSS alternative to Bloomberg Terminal.

Gamestonk Terminal 18.6k Jan 3, 2023
uploadgram uses your Telegram account to upload files up to 2GiB, from the Terminal.

uploadgram uploadgram uses your Telegram account to upload files up to 2GiB, from the Terminal. Heavily inspired by the telegram-upload Installing: pi

Shrimadhav U K 97 Jan 6, 2023
💥 Share files easily over your local network from the terminal!

Fileshare ?? Share files easily over your local network from the terminal! ?? Installation # clone the repo $ git clone https://github.com/dopevog/fil

Dopevog 11 Sep 10, 2021
CLabel is a terminal-based cluster labeling tool that allows you to explore text data interactively and label clusters based on reviewing that data.

CLabel is a terminal-based cluster labeling tool that allows you to explore text data interactively and label clusters based on reviewing that

Peter Baumgartner 29 Aug 9, 2022
Bear-Shell is a shell based in the terminal or command prompt.

Bear-Shell is a shell based in the terminal or command prompt. You can navigate files, run python files, create files via the BearUtils text editor, and a lot more coming up!

MichaelBear 6 Dec 25, 2021
Bear-Shell is a shell based in the terminal or command prompt.

Bear-Shell is a shell based in the terminal or command prompt. You can navigate files, run python files, create files via the BearUtils text editor, and a lot more coming up!

MichaelBear 6 Dec 25, 2021
Terminal-based keyboard testing

kbdtest kbdtest is a simple Python program that tests keyboard input using an interactive, terminal-based, visual keyboard display. It was originally

Ruunyox 12 Jul 19, 2022