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

Error: Unsupported bit depth 16 #4

Closed IonicaBizau closed 9 years ago

IonicaBizau commented 9 years ago
var ImageToAscii = require ("../index")
  , myImage = new ImageToAscii ({
        resize: {
            height: "100%"
        }
      , colored: true
    })
  ;

myImage.convert("https://avatars3.githubusercontent.com/u/38924?v=3&s=400", function(err, converted) {
    console.log(err || converted);
});
$ node index.js 

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Unsupported bit depth 16
    at Parser._parseIHDR (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/parser.js:180:28)
    at ChunkStream._process (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/chunkstream.js:186:23)
    at ChunkStream.read (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/chunkstream.js:51:10)
    at Parser._handleIHDR (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/parser.js:160:10)
    at Parser._parseChunkBegin (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/parser.js:121:34)
    at ChunkStream._process (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/chunkstream.js:186:23)
    at ChunkStream.read (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/chunkstream.js:51:10)
    at Parser._parseSignature (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/parser.js:91:10)
    at ChunkStream._process (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/chunkstream.js:186:23)
    at ChunkStream.write (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/chunkstream.js:74:10)

The image is successfully resized, but it fails here.

Probably this is a bug in pngjs package which seems not to be maintained anymore. So, a code refactoring is needed. Related to #2.


@izuzak I remember this bug appeared when we met in Zurich, but I hided it by manually downloading the file and saving it in another format. :smile: