IonicaBizau / image-to-ascii

:floppy_disk: A Node.js module that converts images to ASCII art.
http://ionicabizau.net/blog/16
MIT License
1.58k stars 106 forks source link

Windows compatibility #3

Closed IonicaBizau closed 9 years ago

IonicaBizau commented 9 years ago

Contributions are welcome!

ComFreek commented 9 years ago

I'd help, but the error messages Node is giving me aren't very helpful (at least for me):

D:\Downloads\image-to-ascii>npm test

> image-to-ascii@0.1.1 test D:\Downloads\image-to-ascii
> node test/index.js

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:1001:11)
    at Process.ChildProcess._handle.onexit (child_process.js:792:34)
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

D:\Downloads\image-to-ascii>
IonicaBizau commented 9 years ago

That's because currently imagemagick is required. We have to find another alternative for imagemagick, like #2 says.

IonicaBizau commented 9 years ago

@ComFreek Check if this problem was fixed after merging #5 (version 1.0.0).

ComFreek commented 9 years ago

After installing GraphicsMagick it runs at least.

Output in cmd.exe

cmd.exe

D:\Downloads\image-to-ascii>npm test

> image-to-ascii@1.2.0 test D:\Downloads\image-to-ascii
> node test/index.js

0000000GGGGGGGGG000GGGGGGGGGGGGGGGGGGGGGGGGGGG00
0GLLLLCtiiiiiiii1111iiiiiiiiii111iiiiiiiitttttC8
0GLLLLLtiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiitttttC8
0GLLLLCLiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii1tttttC8
0GLLLLf1iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii1ttttC8
0GLLLfiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii1tttC8
0GLLL1iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiitttC8
0GLLLiiiiiiii1fCCGGGGGCCCCCCCGGGCCft11iiiii1ttC8
0GLLL1iiiiiif00G0GG888888888880CGGGCtt1iiii1ttC8
0GLLL1iiiiif00L0tiif0000000000L0tiiLLtf1iiitftC8
0GLLLtiiiiiL00C0iii10000080000C0iiitCtttiiitttC8
8GfLfL1iiiitG8G0GffG00000G0000G0GffCftt1ii1tttC8
0GLLLLLtiiiifG8088800000Gf000880GCLftt1i1tttttC8
0GLLCLLLLt1iiitLCGG00080CGC00GCLtttt111tttttttC8
0GLLffLLCLLfft1ii111tttttttt11111111ttttttttttC8
0GLLf1i1fLLLLLLLLfiiiitftfi11i1tttttttttttttttC8
0GLCCLtiitLLLLLCfiiiiiitt11tf1i1ftttttttttttttC8
8C1t1tt1iii1tt11iiiiiiiiiiiiii1i11111111111111C8
8Lif1tttLf1tff1i1L1f1tttLf1iiffL1tff1tLftifffiL8
8CitLL1fL1iLf11iiLtLfLtfL1ii1C1ttLtfftL1C1Lt1iC8
8CiiLfifLtiiffiiitLfLL1fLtii1L1iiLtfftL1L1LftiC8
8CiiLfifL11f1Lfii1CtfLifL11i1LtLtLtfftLtL1Lt1iC8
8Ciittitff1tft1iiit1ttitff1iitft11ff11ft1itffiC8
00GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG00

D:\Downloads\image-to-ascii>

Output in PowerShell

PowerShell

PS D:\Downloads\image-to-ascii> npm test

> image-to-ascii@1.2.0 test D:\Downloads\image-to-ascii
> node test/index.js

00000000000000088888888888888888000000088888888888888888888888888888888888888888888888888888888000
0000GGGGGGGGGGGGCCCCCCCCCCCCCCCCG00000GGGGGCCCCCCCCCCCCCCCGGGGGGGGGCCCCCCCCCCCCCCCCCGGGGGGGGGGG000
000CLLLLLLLLLLLtiiiiiiiiiiiiiiii1ttt111iiiiiiiiiiiiiiiiiiiiiii1111iiiiiiiiiiiiiiiii1ttttttttttf800
000CLLLLLLLLLLLtiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii1ttttttttttL800
000CLLLLLLLLLLL1iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii1ttttttttttL800
000CLLLLLLLLLLCtiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii1ttttttttttL800
000CLLLLLLLLLLLfiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiitttttttttttL800
000CLLLLLLLLLLLL1iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii1tttttttttttL800
000CLLLLLLLLLCf1iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii1ttttttttttL800
000CLLLLLLLLLfiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii1ttttttttL800
000CLLLLLLLLtiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii1tttttttL800
000CLLLLLLLfiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii1ttttttL800
000CLLLLLLLiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiittttttL800
000CLLLLLCtiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii1tttttL800
000CLLLLLL1iiiiiiiiiiiiiiiiiii111ttffffffftttttt1111111ttttttfffffftt11111iiiiiiiiiiiiii1tttttL800
000CLLLLLL1iiiiiiiiiiiiiiii1tfCG000088800000000000000000000000008880GCftttt11iiiiiiiiiiiitttttL800
000CLLLLLL1iiiiiiiiiiiiii1fLG080GCCGG0000000000000000000000000080CCCG00Lttttt1iiiiiiiiiiitttttL800
000CLLLLLL1iiiiiiiiiiiiitLG008CfC000000800000000000000000000000LfC000G08Ctttttt1iiiiiiiiitttttL800
000CLLLLLLtiiiiiiiiiiiitLG008Ct080f111fG0000000000000000000008ff08Ct111L0Ltttttt1iiiiiii1tttttL800
000CLLLLLCfiiiiiiiiiii1fC0000tG8G1iiiii1G00000000000000000008Ct88Liiiiiit0fttttttiiiiiii1tttttL800
000CLLLLLLLiiiiiiiiiii1fG008Cf88fi1iiiiif00000000000000000008fC801iiiiiiiCCttttttiiiiiiittttttL800
000CLLLLLLCtiiiiiiiiii1fG008Gf88Liiiiiiif00000000000000000008LC80tiiiiiiiGCttttttiiiiii1ttttttL800
000Lffffffff1iiiiiiiii1fC0000f080tiiiii1G00000000000000000008GL88Giiiiiit8fttttttiiiiiitttttt1f800
000CLLLLLLLLfiiiiiiiiiitCG008GC080Lt1tL00000000000888800000008CC08Gft1tC8Ltttttt1iiiii1tttttttL800
000LffffffffLf1iiiiiiii1fC00080G008800800000000000LtfG000000008GG0088880Ltttttt1iiiii1ttttttt1f800
000CLLLLLLLLLCL1iiiiiiii1tC00000000000000000000088f11G8000000000000CCLfttttttt1iiii1ttttttttttL800
000CLLLLLLLLLLLLf1iiiiiiii1fCG008000000000000000C08888CG000000800GLtttttttttt1iii1ttttttttttttL800
000CLLLLLLLLLLLLLLftiiiiiiii1tfLCG00000088880008LtLCCft088800GCLfttttttttt11iii1ttttttttttttttL800
000CLLLLLLLLLLLLLLLLLft1iiiiiii11ttffLLCCGGGG00080CCCC00GCCLfftttttttt11iiii1tttttttttttttttttL800
000CLLLLfLLLLLLLLLLLLLLLfft11iiiiiiiii111111ttttttffftttt111111111iiiii111ttttttttttttttttttttL800
000CLLLti1f1tffLLLLLLLLLLLLLLLfftt1111iiiiiiiiiiiiiiiiiiiiiiiiii1111ttttttttttttttttttttttttttL800
000CLLLLft1it1ii1LLLLLLLLLLLLLLLCLLCf1iiiiiiitCCfttCCti1111ii1ttttttttttttttttttttttttttttttttL800
000CLLLLLCLtiiiii1fCLLLLLLLLLLLLLLLtiiiiiiiiiit0G1CGtitfttftiii1ttttttttttttttttttttttttttttttL800
000CLLLLLLLLtiiiiiitLCLLLLLLLLLLLCtiiiiiiiiiiii1ftt1iitL11Lfiiii1tttttttttttttttttttttttttttttL800
000CLCCCCCLCCL1iiiii1tfLLCCCCLLLLfiiiiiiiiiiiiiii1iiii1ttftiiiiiitftttttttttttttttttttttttttttL800
008ftttttttttttiiiiiiii11tttttt11iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii11111111111111111111111111111f800
008tiiiiiiiiiii111111iiii11iiiiiii111iii1iii11ii111111iiiiiii111iiiiii111iiii11iiiiiii111i1iiit800
008ti1LLfi1LLfiLLLLLL1itLLLLf1iiiitLL1ifCti1LL11LLLLLLiiiii1LLLLLtiitLLLLf1itLLLLLf1i1LLLLLL1it800
008tiitCL1tCL1iLCLtttitCLt1LCfiiii1LL1iLCfitCLi1LLftt1iiiiiLCL1fCL11CLt1LCfitCLttLCfi1LLftttiit800
008tiiiLCffCfiiLCfiiiitLLti1t1iiiiiLCt1LLLifCfitLLtiiiiiii1LLfitLL1tLL1iLLfitLL1ifLLi1LCtiiiiit800
008tiiitCLLL1iiLLL111iifCLtiiiiiiiifCftCLL1fCtitLLf11iiiii1LCfi111itLL1iLCfitLLtifLL11LLf11iiit800
008tiiiiLLLtiiiLLLLCtiiitLCf1iiiiiitCLfLfLfLL1itLLLCLiiiii1LCfiiiiitLL1iLCfitLL1ifLL11LLLCL1iit800
008tiiiitLL1iiiLLL111iiii1LCL1iiiii1LLLL1LLLLiitLLt11iiiii1LCfi111itLL1iLCfitLLtifLL11LLf11iiit800
008tiiiitLL1iiiLCfiiiitfti1LCfiiiiiiLLLfiLLLfii1LLtiiiiiii1LLfitLL1tLL1iLLfitLL1ifLLi1LCtiiiiit800
008tiiiitCL1iiiLCL1ttifCL11LCfiiiiiifLLtifLLtiitLLf1t1iiiiiLCL1fCL11CLt1LCfitCLttLCfi1LLf1t1iit800
008tiiiitLL1iiiLLLLLC11fLLLLf1iiiiii1LL1itLL1iitLLLLCLiiiii1LLLLLtiitLLLLf1itLLLLLf1i1LLLLLL1it800
008tiiiiiiiiiiiiiiiiiiiii11iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii11iiiiii11iiiiiiiiiiiiiiiiiiiiiit800
000GCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCGCCGCCCCCCCCCCCCCGCCCCCCCCCCCG000
00088888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888000

PS D:\Downloads\image-to-ascii>

The latter output actually seems very acceptable, but only on GitHub. That is to say the window's dimensions are incorrectly calculated.

IonicaBizau commented 9 years ago

Wow! Cool! :smile:

ComFreek commented 9 years ago

@IonicaBizau I think you missed my edit :)

IonicaBizau commented 9 years ago

Can you post a screenshot with colored: false?

var ImageToAscii = require("../lib/index");

ImageToAscii({
    path: __dirname + "/octocat.png"
  , colored: false
}, function(err, converted) {
    console.log(err || converted);
});

It seems that the issue is almost fixed, colors being unsupported right now.

ComFreek commented 9 years ago

Yeah, it works! :) Screenshot of image-to-ascii in cmd.exe and PowerShell

I tried using ansicon to no avail, however.