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.
npm install ink-pictureVerified import paths — ran on the pinned version, not inferred.
This example demonstrates the basic setup for `ink-picture`, rendering an image from a URL within an Ink application, wrapped in the required `TerminalInfoProvider`.
Ensure your Ink component tree, or at least the part containing `<Image>` components, is wrapped with `<TerminalInfoProvider>`.
Upgrade your Node.js environment to version 18 or newer.
Ensure `ink` and `react` are installed at their specified minimum versions: `npm install ink@"^5" react@"^18"`.
Update your codebase to leverage the specific literal union types for the `protocol` prop for better type safety and autocompletion.
If you need to display images before they are fully loaded, explicitly set `allowPartial={true}` on the `Image` component.Wrap your root Ink component, or at least the section containing `Image` components, with `<TerminalInfoProvider>`.
Change your import statement to `import Image, { TerminalInfoProvider } from 'ink-picture'` to correctly import `Image` as the default export.Change your import statement to `import { TerminalInfoProvider } from 'ink-picture'` (or `import Image, { TerminalInfoProvider } from 'ink-picture'`) to correctly import `TerminalInfoProvider` as a named export.Ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json`) and use `import` statements instead of `require()`.