npm-gif
npm-gif copied to clipboard
Add Windows Support
Hi, are you planning to make npm-gif
available for other OSes' terminals? Thanks!
Hi @thiagodp! I would love to. However, the limitation is in the terminal itself. The terminal has to support embedding images and as far as I know iTerm2 is the only one that currently does.
I see... Since other terminals only support ascii, it would be necessary to do some kind of ascii art or braille animation. So definitively, to simulate this would be a task for a different project (not a gif-based). Thank you, anyway!
BTW, I just found an ascii art -based gif cli.
Definitely lower-res than the real image, but here are some pure-JavaScript options for getting some version of the image in non-iTerm2 terminals:
- The picture-tube module makes it easy to pipe a PNG write stream (one of the gif-frames output stream options) into the terminal window as ansi terminal characters... however I don't think that really lets you replace a specific region of the terminal window.
- For finer control you can use picture-tube's dependency, charm, which lets you set a specific terminal character position equal to a color value.
- For this one you would need access to the decoded data, so you could either re-decode the output frames from gif-frames using get-pixels, or just use get-pixels to decode the GIF in the first place.
More work, but would be cool. 😄
Also looks like image-to-ascii would be perfect for this (much higher res than just color blocks)... if it supported file streams or Buffers!
@benwiley4000 Very interesting! Think I may have to switch progress-img's default fallback to image-to-ascii!
@kodie I looked and the underlying image parsing engine (lwipify) actually seems to support Buffer
objects so I think you could supply one of those as the source
argument to imageToAscii
.
@benwiley4000 I've been playing around with image-to-ascii and it does in fact support buffers right out of the box luckily.
Good to hear!
Great!
@benwiley4000 @thiagodp The biggest thing stopping me from implementing this is that image-to-ascii relies on image-parser which requires GraphicsMagick to be installed on the user's system.
Which means that if implemented and a user runs npm install npm-gif
, the install will fail unless they have GraphicsMagick installed on their system.
@kodie this one has no native dependencies. https://github.com/ajay-gandhi/asciify-image
Like the other module, it claims it takes a string path but I think a Buffer will work since it relies on lwip
.
@benwiley4000 Unfortunately lwip doesn't support modern node versions quite yet :( https://github.com/EyalAr/lwip/issues/297
Aaah. Also I'm realizing the "no native dependencies" is a lie since lwip has some. ETA: The only advantage I guess is that you don't need to count on the user to install anything manually, but it's still prone to issues when you change Node versions, as with all C++ bindings.
@thiagodp @benwiley4000 I have made a pull request for asciify-image that would make it truly dependency-free so if that gets merged we'll be in business!
Awesome! Looking forward to what comes next.
@benwiley4000 @thiagodp Please install the new release (v1.0.2) and give it a try!
Hi,
Not working with mac OS terminal
And the image appears after installing the packages on iTerm2
✗ npm --version
6.1.0
iTerm 3.1.7
Hi, @kodie , sorry for giving you feedback so late...
Anyway, this was the result on Windows 10:
The ascii appeared at once.
@thiagodp No worries, thank you for the feedback. I will look into this.
Git bash too :(