M
M
Magnus Keef2019-03-31 18:35:56
Node.js
Magnus Keef, 2019-03-31 18:35:56

Is it possible to do Huffman image encoding in node js?

Please tell me what steps to take to complete this task.
The encoding is done for the bmp image.
As far as I understand, there should be the following steps:
1. Get the binary representation of the image. This includes both the image title and a set of pixel brightnesses.
2. Create a binary tree of bit combinations.
3. Create an encoding table based on the tree.
4. Write the table to the image header.
5. We create a bmp image and write all the above data into it.
The main question is how to get a binary representation of an image on node js? How to process this data?
Are there examples of such tasks?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Robur, 2019-03-31
@SecurityYourFingers

The main question is how to get a binary representation of an image on node js? How to process this data?

Use Buffer to store and work with binary data. You can read the file immediately into it, then - convert it as you like and write it back.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question