Why don't we just use a hash function to reduce the size of a bitmap, rgb or raw image? Isn't it more efficient of storage data and it produces lossless image after being decoded? The decoder is also very simple, and it would use an universal standard hash code for all images. Some private image would have its own hash code. Isn't it an opportunity for us to compress a file to very low capacity, without any complicated algorithm and entropy code?

  • 1
    $\begingroup$ Are you implying that everyone keeps a database of images on their computer that's indexed by the "universal hash"? $\endgroup$
    – Simon F
    Feb 14, 2018 at 9:09
  • $\begingroup$ I also went through a stage of thinking up lots of brilliant ideas to use hashes to get around limits on compression. It took a long time to realise why they definitely cannot work. I recommend reading about data compression. $\endgroup$ Feb 16, 2018 at 21:41

1 Answer 1


Unlike a compression function, which can be reversed to recover (an approximation to) the original data, a hash function is irreversible. You can hash your image, and the hash is a lot smaller than the original image, but you can't get the original image back from the hash.

A hash function is useful for cases where there are only a small number of possible images, which everyone knows about. An example use-case might be something like Telegram or WhatsApp stickers, where there's a fixed set of images, and centrally assigning ID numbers causes distributed systems problems.

  • $\begingroup$ i understand,but my idea is: 110011 + hash code = 00ii00 = 0110, i is complex number and converted to 1,1 is converted to 0 and 00 is 0. $\endgroup$
    – Lan...
    Feb 13, 2018 at 16:03
  • $\begingroup$ so 01101110 will become 101001,let's decode: original zero is always invert to 1,1 is always converted to zero,two zero after converted is converted to only 0. $\endgroup$
    – Lan...
    Feb 13, 2018 at 16:16
  • 2
    $\begingroup$ I have no idea what you're talking about. I don't think you're describing a hash code. $\endgroup$
    – Dan Hulme
    Feb 13, 2018 at 18:58
  • $\begingroup$ then i quantized the code with my own algorithm,i have test this several times with different code length and it can recreate 99% of code. 101001 = 001.after recreated = 01101110,this is normalized and it works for all different binary code. $\endgroup$
    – Lan...
    Feb 14, 2018 at 0:10
  • 3
    $\begingroup$ @Lan... it sounds like you have no idea how compression works. Do some research to understand the pigeon hole issue. $\endgroup$ Feb 14, 2018 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.