creatale / node-dv

A node.js library for processing and understanding scanned documents
Other
340 stars 72 forks source link

Support to initialize image formats other than jpg and png #25

Open smravi opened 9 years ago

smravi commented 9 years ago

If I have a gif image how can I initialize the image or is there a support to convert image formats ?

WolfgangFellger commented 9 years ago

Only PNG and JPEG are natively supported as input formats, everything else has to be decoded by other means and handed in using the raw image data.

E.g., use https://www.npmjs.com/package/gif-stream to decode the image, then pass the frame you receive to dv using new dv.Image('rgb', frame.pixels, frame.width, frame.height) (untested).

If there is demand, we could include GIF support directly. However note that you will probably need at least 200 dpi for dv to be useful, for which GIF is not a typical format. Also the fact that it can store more than one frame will have to be dealt with.

smravi commented 9 years ago

Thanks. I am using this module for tesseract where the user uploads the image to be decoded to text. Is there a generic way or any other available module in node that will support other image formats conversion to jpg/png. So that I can supply the image to dv. ?

smravi commented 9 years ago

top three popular image formats includes gif. It will be helpful if gif is supported for dv - http://w3techs.com/technologies/overview/image_format/all