Convert Figma logo to code with AI

atanunq logoviu

Terminal image viewer with native support for iTerm and Kitty

2,523
55
2,523
35

Top Related Projects

A pocket-sized implementation of Bitcoin

Quick Overview

The viu project is a command-line tool for viewing images in the terminal. It supports a variety of image formats and provides features like zooming, panning, and color adjustments.

Pros

  • Cross-platform: viu is available for Windows, macOS, and Linux, making it accessible to a wide range of users.
  • Fast and Efficient: The tool is designed to be lightweight and fast, allowing for quick image viewing without significant resource usage.
  • Customizable: Users can adjust various settings, such as the display mode, color scheme, and keyboard shortcuts, to personalize their viewing experience.
  • Supports Multiple Image Formats: viu can handle a wide range of image formats, including JPEG, PNG, GIF, BMP, and SVG.

Cons

  • Limited Image Editing Capabilities: While viu allows for basic image viewing and manipulation, it does not provide advanced editing features like cropping, resizing, or applying filters.
  • Dependency on External Libraries: The tool relies on several external libraries, which may introduce compatibility issues or require additional setup on some systems.
  • Lack of Integration with Other Tools: viu operates as a standalone application and does not currently integrate with popular image viewers or file managers.
  • Occasional Rendering Issues: Some users have reported occasional issues with image rendering, particularly for certain file formats or high-resolution images.

Code Examples

N/A (This is not a code library)

Getting Started

N/A (This is not a code library)

Competitor Comparisons

A pocket-sized implementation of Bitcoin

Pros of tinychain

  • Educational focus: Provides a simplified implementation of a blockchain for learning purposes
  • Detailed documentation: Includes extensive comments and explanations throughout the code
  • Minimal dependencies: Relies on few external libraries, making it easier to understand and modify

Cons of tinychain

  • Limited functionality: Lacks advanced features found in production-ready blockchain implementations
  • Not actively maintained: Last commit was several years ago, potentially outdated
  • Single-language implementation: Written only in Python, limiting accessibility for developers using other languages

Code comparison

tinychain (Python):

class Block:
    def __init__(self, height, transactions, timestamp, previous_block_hash):
        self.height = height
        self.transactions = transactions
        self.timestamp = timestamp
        self.previous_block_hash = previous_block_hash
        self.hash = self.generate_hash()

viu (Rust):

pub struct Image {
    pub path: PathBuf,
    pub frames: Vec<Frame>,
    pub size: Option<(u32, u32)>,
    pub is_animated: bool,
}

Summary

tinychain is a Python-based educational blockchain implementation, offering simplicity and detailed documentation. viu, on the other hand, is a Rust-based terminal image viewer, focusing on practical functionality rather than blockchain concepts. While tinychain serves as a learning tool for blockchain enthusiasts, viu provides a utility for viewing images in the terminal, catering to different user needs and programming paradigms.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Description

A small command-line application to view images from the terminal written in Rust. It is basically the front-end of viuer. It uses either iTerm or Kitty graphics protocol, if supported. If not, lower half blocks (▄ or \u2584) are displayed instead.

Based on the value of $TERM, viuer decides which protocol to use. For half blocks, $COLORTERM is inspected. If it contains either truecolor or 24bit, truecolor (16 million colors) will be used. If not, it will fallback to using only ansi256. A nice explanation can be found in this gist.

Features

  • Native iTerm and Kitty support
  • Animated GIF support
  • Accept media through stdin
  • Custom dimensions
  • Transparency
  • Experimental Sixel support (behind the sixel feature flag)

Installation

From source (recommended)

Installation from source requires a local Rust environment.

git clone https://github.com/atanunq/viu.git

# Build & Install
cd viu/
cargo install --path .

# Use
viu img/giphy.gif

Or without cloning:

cargo install viu

Binary

A precompiled binary can be downloaded from the release page. GPG fingerprint is B195BADA40BEF20E4907A5AC628280A0217A7B0F.

Packages

MacOS

Available in brew.

brew install viu

Arch Linux

Available in extra/viu.

pacman -S viu

NetBSD

Available in graphics/viu.

Usage

Examples

On a Kitty terminal:

Kitty

On a Mac with iTerm:

iTerm

Using half blocks (Kitty protocol and tmux do not get along):

Demo

Demo

Demo

Ctrl-C was pressed to stop the GIFs.

When viu receives only one file and it is GIF, it will be displayed over and over until Ctrl-C is pressed. However, when couple of files are up for display the GIF will be displayed only once.

iTerm note

iTerm can handle GIFs by itself with better performance, but configuration through --once and --frame-rate will have no effect there.

Aspect Ratio

If no flags are supplied to viu it will try to get the size of the terminal where it was invoked. If it succeeds it will fit the image and preserve the aspect ratio. The aspect ratio will be changed only if both options -w and -h are used together.

Command line options

View images right from the terminal.

Usage: viu [OPTIONS] [file]...

Arguments:
  [file]...  The images to be displayed. Set to - for standard input.

Options:
  -w, --width <width>
          Resize the image to a provided width
  -h, --height <height>
          Resize the image to a provided height
  -x <x>
          X offset [default: 0]
  -y <y>
          Y offset [default: 0]
  -a, --absolute-offset
          Make the x and y offset be relative to the top left terminal corner. If not set, they are relative to the cursor's position.
  -r, --recursive
          Recurse down directories if passed one
  -b, --blocks
          Force block output
  -n, --name
          Output the name of the file before displaying
  -t, --transparent
          Display transparent images with transparent background
  -f, --frame-rate <frames-per-second>
          Play the gif at a given frame rate
  -1, --once
          Loop only once through the gif
  -s, --static
          Show only the first frame of the gif
  -H, --help
          Print help information
  -V, --version
          Print version information

NPM DownloadsLast 30 Days