sindresorhus/terminal-image

Support setting width/height

sindresorhus opened this issue ยท 12 comments

Should be easy to support this through an options object, but I didn't want to do it before anyone had a need for it. PR welcome if so.

Hey, currently working on this. Should have a pr in the evening sometime.

In fact, I'm interested on this feature for https://github.com/piranna/ansi-widgets :-)

terminal-image/index.js

Lines 41 to 42 in a659386

width: '100%',
height: '100%',

term-img allow to define the sizes using chars as unit, so it could be used for both it and jimp. For the preserveAspectRatio option maybe would be checked to use the resize() method or any other similar one...

I'm also interested in this, so I'm really looking forward to your PR, @RobertJGabriel ๐Ÿ˜Š

And BTW: As always, this is awesome work, @sindresorhus! Thanks a lot for all of your great open source work ๐Ÿ˜Š

PS: I have created a PR to address this issue, see #6

And BTW: As always, this is awesome work, @sindresorhus! Thanks a lot for all of your great open source work

Yeah, I have started my project just some days ago, and I'm finding all your repos everywhere! Kudos! :-D

@sindresorhus I'm building a terminal app and urgently need this feature.

I didnโ€™t want to wait any more, too, and built my own solution: https://www.npmjs.com/package/terminal-img

@goloroden nice, but I need something that doesn't directly output to the console. Guess I have to write my own too.

If you give me a few hours, I can include that.

@yuanfux I have just released a new version, 1.1.0, which now includes a draw.asString function: https://www.npmjs.com/package/terminal-img

I think that it would be helpful to continue discussion about the terminal-img module in its own repository: https://github.com/thenativeweb/terminal-img

Fixed by c8caaa3