Giter Club home page Giter Club logo

imgprev's Introduction

Image previewer (imgprev)

Summary

A simple and powerful Rust CLI application to display images in non visual interfaces (for example, ssh).

Install

Linux

Just run this command to install the application:

curl -s https://raw.githubusercontent.com/wikiti/imgprev/master/install.sh | sh

and the application will be directly installed into the /usr/local/bin folder as imgprev.

Manual

You can download the binary files from the releases section, or build it by yourself with Rust. After that, place the binary file in a directory accessible by PATH (e.g. in /usr/bin/). Otherwise, you may want to put the executable in any folder, and prefix the executable with corresponding directory path (e.g. /home/test/dev/imgprev).

Please bear in mind that this application must be installed in the target machine if you are ussing ssh.

Usage

Once installed, you can use the program within your favourite command line:

imgprev path/to/my/image/cat.jpg

Which should output something like this:

Screenshot

Cute, isn't it? Now, you can preview images in a non-GUI enviroment without downloading the file!

By default, the image will be scalated to fit into the console (around 100 columns wide).

To know more about the available options, use

imgprev --help

or check the Options section of this file.

Supported formats

These are the image extensions supported by this application:

Options

Render mode

Used with the -m or --mode option.

Multiple render modes are supported for this application. The following table summarizes them:

Name Description
ansi Use ansi colors (256) to render the image. This is the default mode.
grayscale Same as ansy, but using grayscale colors.
true_color Use true color mode (rgb). Not supported in many terminals.
text Use ascii characters to represent the image. Ideal for simple terminals without color support.

For example, the same image in different modes:

Screenshot

And, as a bonus, a cat in ascii :

Max width

Used with the -w or --width option; it sets the maximum width to fit the image. Each image pixel equals to 2 console characters. Use any value greater than 0.

For example, two different outputs for different sizes. With max width 30:

$ imgprev samples/ubuntu.png -w 30

which will output this:

Screenshot

while this, with max width 15:

$ imgprev samples/ubuntu.png -w 15

will output this:

Screenshot

Resize filter

Used with the -f or --filter option.

This application allow to use multiple resize filters or algorithms:

  • none: Use the nearest neighbour (pixel).
  • linear: Create a linear interpolation between pixels.
  • cubic: Create a cubir interpolation between pixels
  • gaussian: Use a gaussian function to compute the pixel's value.
  • lanczos3: Lanczos algorithm with window's size 3.

Here is a example of the available filters for a single image (in true color):

Screenshot

Development

Dependencies

This project was developed using Rust v1.11.0. It uses the following crates:

  • image: Image file handling for Rust.
  • lazy_static: Lazy initialization for static references.
  • clap-rs: A powerful library to create CLI applications.

Build

Clone this repository and install it with:

git clone https://github.com/wikiti/imgprev.git
cd imgprev
cargo build --release
target/release/imgprev examples/ubuntu.png

Run tests

Use cargo to run unit tests:

cargo test

Authors

This project has been developed by:

Avatar Name Nickname Email
Daniel Herzog Wikiti [email protected]

imgprev's People

Contributors

wikiti avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.