{"name":"terminal-image","version":"4.3.0","keywords":["terminal","image","term","iterm","shell","console","command-line","img","pic","picture","photo","ansi","escape","jpg","jpeg","display","show","pixels","gif","animation","sequence"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"terminal-image@4.3.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/terminal-image#readme","bugs":{"url":"https://github.com/sindresorhus/terminal-image/issues"},"dist":{"shasum":"ba9ded678ac9d7f4ed685e36fe2be6baf6aad864","tarball":"http://registry-npm.ywwl.com/terminal-image/download/terminal-image-4.3.0.tgz","fileCount":6,"integrity":"sha512-P4bCi7Ich17LgN/P2zM9sYbeleYNgu1Skk3q/uc15Ol9zWSiCldrCcIJ1Pd6dpgRGDmWhGVTgWHjV+ZMk1m/5g==","signatures":[{"sig":"MEQCIDjxXRGO7EHNdz76hSCXVG4MVKsgrSSpObCdwIm4Q0HWAiBy9opoquo2xn2BCfIaLuEjsd0m0+jJyC7bFzscUcu8kQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31599,"size":8226,"noattachment":false,"key":"/terminal-image/-/terminal-image-4.3.0.tgz"},"type":"module","types":"./index.d.ts","engines":{"node":">=20"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"e09963d76cd1c1a29d7fef9087fffed3b28e5e68","scripts":{"test":"xo && ava"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/terminal-image.git","type":"git"},"_npmVersion":"11.12.0","description":"Display images in the terminal","directories":{},"sideEffects":false,"_nodeVersion":"25.8.0","dependencies":{"jimp":"^1.6.1","chalk":"^5.6.2","omggif":"^1.0.10","term-img":"^7.0.0","log-update":"^8.0.0","image-dimensions":"^2.5.0","supports-terminal-graphics":"^0.1.0"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^1.2.2","ava":"^6.4.1","@types/node":"^24.3.1"},"_npmOperationalInternal":{"tmp":"tmp/terminal-image_4.3.0_1776027561153_0.8173327945444511","host":"s3://npm-registry-packages-npm-production"},"readme":"# terminal-image\n\n> Display images in the terminal\n\nWorks in any terminal that supports colors.\n\n<img src=\"screenshot.png\" width=\"1082\">\n\n*In iTerm, Kitty, WezTerm, and other terminals with graphics support, the image will be displayed in full resolution. In other terminals, it will be rendered using ANSI block characters.*\n\n## Install\n\n```sh\nnpm install terminal-image\n```\n\n## Usage\n\n```js\nimport terminalImage from 'terminal-image';\n\nconsole.log(await terminalImage.file('unicorn.jpg'));\n```\n\nOptionally, you can specify the `height` and/or `width` to scale the image. That can be either the percentage of the terminal window or number of rows and/or columns. Please note that the image will always be scaled to fit the size of the terminal. If width and height are not defined, by default the image will take the width and height of the terminal.\n\nIt is recommended to use the percentage option.\n\n```js\nimport terminalImage from 'terminal-image';\n\nconsole.log(await terminalImage.file('unicorn.jpg', {width: '50%', height: '50%'}));\n```\n\nYou can set width and/or height as columns and/or rows of the terminal window as well.\n\n```js\nimport terminalImage from 'terminal-image';\n\nconsole.log(await terminalImage.file('unicorn.jpg', {width: 50}));\n```\n\nBy default, aspect ratio is always maintained. If you don't want to maintain aspect ratio, set `preserveAspectRatio` to false. However, your image will be scaled to fit the size of the terminal.\n\n```js\nimport terminalImage from 'terminal-image';\n\nconsole.log(await terminalImage.file('unicorn.jpg', {width: 70, height: 50, preserveAspectRatio: false}));\n```\n\n## API\n\nSupports PNG and JPEG images. Animated GIFs are also supported with `.gifBuffer` and `.gifFile`.\n\n### terminalImage.buffer(imageBuffer, options?)\n### terminalImage.file(filePath, options?)\n\nReturns a `Promise<string>` with the ANSI escape codes to display the image.\n\n### terminalImage.gifBuffer(imageBuffer, options?)\n### terminalImage.gifFile(filePath, options?)\n\nReturns a function that can be called to stop the GIF animation.\n\n#### options\n\nType: `object`\n\n##### height\n\nType: `string | number`\n\nCustom image height.\n\nCan be set as percentage or number of rows of the terminal. It is recommended to use the percentage options.\n\n##### width\n\nType: `string | number`\n\nCustom image width.\n\nCan be set as percentage or number of columns of the terminal. It is recommended to use the percentage options.\n\n##### preserveAspectRatio\n\nType: `boolean`\\\nDefault: `true`\n\nWhether to maintain image aspect ratio or not.\n\n##### preferNativeRender\n\nType: `boolean`\\\nDefault: `true`\n\nPrefer native terminal image protocols when available; set to false to force ANSI rendering.\n\n##### maximumFrameRate\n\n**Only works for `terminalImage.gifBuffer` or `terminalImage.gifFile`**\n\nType: `number`\\\nDefault: `30`\n\nMaximum framerate to render the GIF. This option is ignored when using iTerm.\n\n##### renderFrame\n\n**Only works for `terminalImage.gifBuffer` or `terminalImage.gifFile`**\n\nType: `(text: string) => void`\\\nDefault: [log-update](https://github.com/sindresorhus/log-update)\n\nCustom handler which is run for each frame of the GIF.\n\nThis can be set to change how each frame is shown.\n\n##### renderFrame.done\n\n**Only works for `terminalImage.gifBuffer` or `terminalImage.gifFile`**\n\nType: `() => void`\\\nDefault: [log-update](https://github.com/sindresorhus/log-update)\n\nCustom handler which is run when the animation playback is stopped.\n\nThis can be set to perform a cleanup when playback has finished.\n\n## Terminal Protocol Support\n\nIt automatically detects and uses the best available protocol:\n\n1. **Kitty Graphics Protocol** - Full resolution support in Kitty, Konsole, WezTerm (when configured)\n1. **iTerm2 Inline Images Protocol** - Full resolution support in iTerm2 and compatible terminals\n1. **ANSI Block Characters** - Universal fallback using Unicode half-blocks with 24-bit color\n\n## Tip\n\n### Display a remote image\n\n```js\nimport terminalImage from 'terminal-image';\nimport got from 'got';\n\nconst body = await got('https://sindresorhus.com/unicorn').buffer();\nconsole.log(await terminalImage.buffer(body));\n```\n\n## Related\n\n- [terminal-image-cli](https://github.com/sindresorhus/terminal-image-cli) - CLI for this module\n- [terminal-link](https://github.com/sindresorhus/terminal-link) - Create clickable links in the terminal\n- [chalk](https://github.com/chalk/chalk) - Style and color text in the terminal\n","publish_time":1776027561300,"_cnpm_publish_time":1776027561300,"dist-tags":{"latest":"5.0.1"}}