Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with cli-table? #32

Open
donmccurdy opened this issue Aug 13, 2020 · 2 comments
Open

Compatibility with cli-table? #32

donmccurdy opened this issue Aug 13, 2020 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@donmccurdy
Copy link

Doing a quick test to see if I can use this with https://github.com/Automattic/cli-table ...

const terminalImage = require('terminal-image');
const Table = require('cli-table');

(async () => {
	const img = await terminalImage.file(process.argv[2], {width: 50, height: 50});

	const table = new Table({head: ['img', 'caption']});
	table.push([img, 'description #1'], [img, 'description #2']);
	console.log(table.toString());
})();

It works nicely in macOS native terminal:

Screen Shot 2020-08-13 at 12 03 56 PM

But in iTerm 2 I'm getting a screen full of lines, like the table thinks the output is (much) larger than it is. Customizing row widths in cli-table doesn't seem to help. Any idea if this is something I could reasonably expect to work, or just incompatible with whatever special image rendering iTerm 2 has? Maybe related to #29? Thanks!

@sindresorhus
Copy link
Owner

sindresorhus commented Aug 14, 2020

iTerm uses a completely different method to render images, which gives us less control over the output. I'm open to adding an option to disable the special iTerm rendering though. That would solve your problem. A good PR would be welcome.

@sindresorhus sindresorhus added enhancement New feature or request help wanted Extra attention is needed labels Aug 14, 2020
@donmccurdy
Copy link
Author

Thanks — Do you know what you'd want the option to be called? Looking at #29 and the comment "The hard part might be to decide, whether to use SIXEL on a certain terminal. Maybe a switch would do in the beginning...", perhaps a format option that's future-proof against that addition?

terminalImage.file('image.png', {
  format: "AUTO" | "COMPAT" | "SIXEL"
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants