GithubHelp home page GithubHelp logo

jjstoo / qimg Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 700 KB

Quick Image Display - Display images in terminal sessions

Home Page: https://jjstoo.github.io/qimg/

License: GNU General Public License v3.0

CMake 0.05% C 99.95%
linux linux-terminal image-display image-viewer lightweight c framebuffer qimg linux-framebuffer fbdev stb-image

qimg's Introduction

Qimg

CodeFactor

CMake build

Please see generated qimg.c docs for detailed usage info and function reference.

Quick Image Display - Display images in terminal sessions

Stuck in a terminal session and wish to quickly inspect some images? Qimg's got you covered!

Without any windowing systems or external dependencies Qimg can be used to display images on every modern(ish) Linux build.

How?

Linux has provided generic gramebuffer support since kernel 2.1.109. The Linux framebuffer (fbdev) is an abstraction layer providing access to hardware-independent graphics. Userspace access is also supported via /dev/fb* device files.

Qimg takes advantage of Linux framebuffer to simply draw out the images as raw pixels on the screen - no tricks, treats or windowing contexts included.

Why?

Mostly for fun but I've had a few occasions on some terminal-only systems where it would've been nice to view images and I found most of the existing solutions too complex and heavyweight for such a simple task.

Cool, how do I use Qimg?

qimg -h will teach you the basics. Usage is outlined by qimg [option]... input....

  • -d <framebuffer dev> uses the given framebuffer device or similar mock-up device file.
  • -b <framebuffer index> selects which frambuffer to use based on device index.
  • -c will try to hide the terminal cursor and prevent it from refreshing on top of the image.
  • -r will repaint the image continuously to prevent anything else from refreshing on top of the image.
  • -delay <seconds> will set slideshow delay.
  • -pos <position> is used set image position.
  • -bg <color> is used to set background color.
  • -scale <scale style> is used to set scale style. Useful for scaling images to fullscreen resolution.

Example usage:

qimg -c -delay 2 -pos c -scale fit input.jpg input2.jpg

This will show the two files as a slideshow on the default framebuffer, scaled to fit the screen and centered. -c will cause the cursor to be hidden which prevents the terminal of refreshing on top of the images.

Exits via SIGINT or SIGTERM will trigger cleanups and restore terminal cursor visibility.

Please note that Qimg will NOT work if an Xorg session or any other framebuffer-overriding services are active on the current TTY.

How to get Qimg

Building Qimg is easy as everything needed for the build is provided in this repository. However, I will be uploading some prebuilt binaries to releases and continuous build artifacts can be downloaded from repository actions.

A huge thank you to stb developers for their excellent image libraries.

qimg's People

Contributors

jmlepisto avatar

Stargazers

 avatar  avatar

Watchers

 avatar

qimg's Issues

Dynamic image loading

As of now, images are loaded in the beginning of the program all at once. This poses memory limitations and slows down program startup.

Images should be loaded in batches, which would minimize memory footprint and speed up program startup.

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.