Ink Picture Component

1.3.5 · active · verified Wed Apr 22

ink-picture is an actively maintained Ink component designed for rendering images within CLI/TUI applications, providing a robust alternative to less feature-rich or unmaintained libraries. Currently at version 1.3.5, the library receives regular updates, including dependency bumps, bug fixes, and new features like partial image loading and support for advanced terminal graphics protocols. It intelligently detects terminal capabilities, supporting Kitty, iTerm2, Sixel, Half-block, Braille, and ASCII art, with graceful fallbacks. Its key differentiator is the automatic and prioritized protocol detection, ensuring the best possible image quality for the user's terminal, and its continuous development compared to dormant alternatives. The package requires Node.js >=18 and peer dependencies of Ink >=5 and React >=18.

Common errors

Warnings

Install

Imports

Quickstart

This example demonstrates the basic setup for `ink-picture`, rendering an image from a URL within an Ink application, wrapped in the required `TerminalInfoProvider`.

import React from 'react';
import { Box, render } from 'ink';
import Image, { TerminalInfoProvider } from 'ink-picture';

function App() {
  return (
    <TerminalInfoProvider>
      <Box flexDirection="column">
        <Image
          src="https://placehold.co/400x200.png?text=Hello+Ink"
          width={40}
          height={20}
          alt="Example image"
        />
      </Box>
    </TerminalInfoProvider>
  );
}

render(<App />);

view raw JSON →