Giter Club home page Giter Club logo

aseity's Introduction

aseity

Have you ever wanted to view an image inside a text-based interface, and were irritated when you had to use a separate program to view it?

Aseity is a simple tool that will render full color (24-bit) images inside any terminal that supports 24-bit color escape codes (https://en.wikipedia.org/wiki/ANSI_escape_code#24-bit), such as PuTTY. The resolution you get depends entirely on how many rows and columns of text you have your terminal set to. If you want to get a high fidelity rendering of your image, turn down your font size as much as possible. If not, you'll get a blocky low-res raster of the image, which often times is all you really need.

Compilation instructions:

  1. Install CImg if you don't have it already via: sudo apt-get install cimg-dev (if you use Ubuntu) or by following the installation steps here: http://www.cimg.eu/
  2. Clone this repository into a new directory
  3. cd into the new directory and type: make. This will build an executable in the directory named "aseity". Note: this requires you have a version of g++ installed that supports the C++17 standard.

How to run the code: ./aseity filename (for example, "./aseity kyoto.jpg")

This will rasterize the image found in filename to the terminal, using the maximum screen size if the image is bigger than the number of columns x rows you have on the screen. It will anti-alias the pixels if it has to rasterize at a lower resolution. If you set your font size to be smaller, you'll get better resolution from the image.

Be aware, terminals were not written with bitmap rasterization in mind, so performance can be slow. Don't rely on this to do anything in real time, and be ready to clear your screen (with ctrl-l) after rasterizing an image. It's also not a faithful rasterization due to terminals having non-square pixels. The code adjusts for this a bit, but it's not perfect.

Here is a rendering of a Monet artwork from entirely within a text-based terminal: Monet in a terminal

This album shows the original artwork and what the art looks like when rasterized at different resolutions: https://imgur.com/a/lAd6unY

The header file in this project, colors.h, can be used in any C++ project that you'd like to add colors to. If you want colored text, once you include it you can do something like this: cout << RED << "Hello " << BLUE << "World!\n" << RESET; to output Hello in red, World in blue, and then resetting the colors back to default after this.

colors.h also functions as a very simple NCURSES-esque library that lets you get the current terminal size, move the cursor to an arbitrary row and column, and change the foreground/background color to any 24-bit value. Basically everything I typically use NCURSES for but without the overhead.

aseity's People

Contributors

shakauvm avatar

Stargazers

 avatar  avatar DC-1 avatar Thomas Trapp avatar Maheshwar Ravuri avatar

Watchers

 avatar

Forkers

mravuri96

aseity's Issues

Not enough bits

I would appreciate 32-bit color. I can't afford photoshop and my windows viewer doesnt work but i need to see my hdr pictures. Please fix

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.