![]() Perhaps the developers will read this article and consider adding such a feature in the future. Neither chafa nor catimg can handle crossfade effects to make the slideshows more interesting. With catimg, you can use the -l option to control how often it plays an animated GIF. The -watch option outputs the image again for each change. By default, chafa uses the terminal's size or 80x25 characters if it cannot determine the size. You can define the output size with -s ( -size) x. The -d ( -duration) option determines how long an image remains in the slideshow (the default is three seconds). For example, you use -c ( -colors) to set color mode to 2, 16, or 256 colors or to a 24-bit view mode. The following two calls use chafa to show a single image and a slideshow of all PNG files in the current directory: $ chafa linux.pngįigure 2: Using chafa to show Tux as a text image.Ĭhafa comes with a number of interesting options for effects. On the other hand, catimg orients an image based on its width resulting in the upper edge of the image disappearing from the terminal display during scrolling. It scales an image to match the current width and height of the terminal window. chafa displays one or more images as an unabridged slideshow in the terminal ( Figure 2). During our research, jp2a, which works similarly to img2txt, also appeared on the scene.įunctioning as image viewers for the terminal, chafa and catimg have only been an integral part of a stable release of the Linux distribution since Debian GNU/Linux 10. Although the name is definitely a reference to the cat/ tac commands, you might interpret catimg to be a tool for displaying cat pictures, but it can do considerably more. In the Spring of 2020, Axel's toolbox included chafa and aha, along with the catimg utility. Displaying Converted Imagesįor quite some time now, we have been experimenting with tools for displaying the converted images. By interpreting the ANSI codes, AnsiLove creates screenshots in PNG format, rather than forcing you to create a screenshot of the text terminal. If you want to save ANSI images as normal images again, you can use the AnsiLove library. Without additional switches in the call, the output text is 60 characters wide and formatted as colored ANSI. To create a letter file named tux.txt, you use the following command: $ img2txt tux.png > tux.txtįigure 1 shows an excerpt from the content of the tux.txt file. The resulting reduction in resolution and color depth not only reduces the volume of data to be transmitted, but it also means that the converted image can be displayed in a text terminal or text-based browser.Īs an example, you can convert a PNG image of the Tux logo into letters with libcaca's img2txt (which replaces imgtoppm from previous library publications). The end result is a rendering of the image using letters with ANSI control codes. For example, you can use the aview and asciiview tools from the Ascii Art Library (AAlib) or img2txt and cacaview from the Colour Ascii Art Library (libcaca). ![]() You do the conversion via filters in the form of libraries. To do this, each pixel (or group of pixels) is assigned a suitably colored single letter, or more precisely a glyph (a graphic symbol). The Conversionįirst, you need to convert an image into individual characters before embedding or displaying it. This article follows up on a previously published article that dealt with tools for creating ASCII art. ![]() ![]() In this article, we will discuss the available tools for converting images to text and explore whether this approach is suitable for everyday use. In a similar manner, the Browsh browser does this internally and can also render images as text. Some text browsers, such as ELinks, then display these images directly in the accessed web page. You can also convert the images to plain HTML and CSS and embed the results in a web page. You can save time and bandwidth by displaying images at a lower resolution and color depth as text (ASCII or Unicode characters) directly in the terminal and converting them with American National Standards (ANSI) color codes. Sometimes you just need an image to display quickly. However, these more detailed images (with a combination of greater image size, resolution, and color depth) come at a cost, consuming more storage space and taking longer to download from remote sources, such as web browsers and webcams. Thanks to increasingly sophisticated technology, displaying high-resolution images on screen is no longer a difficult task.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |