0

I need to get the Huffman coding for the <img> in html, I have a JavaScript function that generates Huffman coding and it takes a string as input, so I need to convert the image in the <img> into a string somehow, get the Huffman coding and output it in the html.

My problem converting the <img> to a string, I've searched a lot but I still don't know how to proceed

Musa
  • 96,336
  • 17
  • 118
  • 137
  • What are you trying to achieve here? Why are you doing this? JPEG images _already_ use Huffman encoding. – Robin Green Jan 04 '14 at 20:01
  • See: [Get image data in Javascript?](http://stackoverflow.com/questions/934012/get-image-data-in-javascript) – Theraot Jan 04 '14 at 20:01

1 Answers1

0

You can use a canvas like this

How to get base64 encoded data from html image

Ultimately you need the image converted to base 64, Which can either be done server side or client side if supported

http://en.wikipedia.org/wiki/Data_URI_scheme

You can then huffman encode the base 64

Community
  • 1
  • 1
exussum
  • 18,275
  • 8
  • 32
  • 65