Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Human brain is two separate organs, Stanford Medicine-led research finds(stanford.edu ↗)
    113comments
  2. AI-generated posters don’t have to be horrible(john.hartnup.uk ↗)
    158comments
  3. “The Secret Life of Circuits” is here(coredump.cx ↗)
    24comments
  4. GPT-6 Astra Solves a WWI German Radio Cipher(prinzai.com ↗)
    79comments
  5. Android 17 is the first since 3.x to add new APIs without releasing to the AOSP(grapheneos.social ↗)
    449comments
  6. If math is more than proof, we need to better celebrate the rest of it(terrytao.wordpress.com ↗)
    107comments
  7. San Francisco Onion Futures Company(onionfutures.com ↗)
    77comments
  8. Laya the open source version of Jev(convaiinnovations.com ↗)
    2comments
  9. Cloudflare Quick Tunnels(cloudflare.com ↗)
    285comments
  10. Communication by means of modulated Johnson noise(pnas.org ↗)
    1comments
  11. SDCC – Small Device C Compiler(sourceforge.net ↗)
    20comments
  12. How to Write with an LLM(sockpuppet.org ↗)
    342comments
  13. Science Is Open Software(jepedersen.dk ↗)
    40comments
  14. Saving another 100TB of RAM(cloudflare.com ↗)
    83comments
  15. You can run Git on object storage if you re-make packfiles(tigrisdata.com ↗)
    18comments
  16. Why building a Rust LSP is hard(rust-glancer.github.io ↗)
    32comments
  17. How OpenAI Used Its Own LLMs to Design Its Jalapeño Chip(ieee.org ↗)
    94comments
  18. From Stonemasons to Carpenters(thelastsoftwareengineer.substack.com ↗)
    1comments
  19. Ctenophores: Wonders of Biology(quantamagazine.org ↗)
    6comments
  20. NASA-IBM Lunar Foundation open-Source Geospatial AI Model(usra.edu ↗)
    4comments
  21. The first new cat species discovered in 100 years(nationalgeographic.com ↗)
    107comments
  22. Apple M6 Pro Achieves the Highest Single-Core CPU Score in Geekbench 7(geekbench.com ↗)
    79comments
  23. OpenJev(openjev.com ↗)
    270comments
  24. Show HN: Cactus Needle 3: 8-29MB automation models can match DeepSeek V4 Flash(cactuscompute.com ↗)
    89comments
  25. Goroutine Leak Profiles(go.dev ↗)
    4comments
  26. Photon-Emission-Guided Laser Fault Injection Enables RP2350 Secure Debug(ledger.com ↗)
    73comments
  27. Veronese's Dogs(publicdomainreview.org ↗)
    1comments
  28. Cache-to-Cache: Direct Semantic Communication Between LLMs (2025)(arxiv.org ↗)
    14comments
  29. Warez: The Infrastructure and Aesthetics of Piracy (2021)(archive.org ↗)
    82comments
  30. Inside ZCode: Silently uploading your Git history to the cloud(ferstar.org ↗)
    101comments

Show HN: An interactive guide to compression basics

256 pointsby 9y agounwttng.com
66 comments
9y agoHN ↗

TODO - proper formatting for maths-y notation

Hmm

9y agoHN ↗

I found this quite hard to read despite the interesting content, mainly due to the animated gifs inserted throughout the article. It's very hard to focus on a line of text when there's an image darting around on the page. I wonder why the author decided to include them?

9y agoHN ↗

Same here, they're useless and look very unprofessional. Keep only the ones that are actually useful.

9y agoHN ↗

Quick solution: add the element to your adblocker. Most let you quickly select elements on the page.

Make sure to get the actual container (might need to do the image first) so you aren't left with giant gaps.

9y agoHN ↗

The fun images may have seemed like a way to lighten things up, but here they're a distraction from the content.. even as still images, every section break doesn't need a happy monkey or Poison Ivy.

9y agoHN ↗

Lose the gifs, and you have a very good article. I think they distract, rather than enhance.

9y agoHN ↗

Or at least a way to toggle them all off at the beginning

9y agoHN ↗

Done, please enjoy your (mostly) gif-free reading

9y agoHN ↗

Add a way to toggle the gifs off at the beginning for people that don't like memes distracting them from the content and you've got yourself a winner.

9y agoHN ↗

Contrary to the rest of the comments here, I enjoyed the gifs.

9y agoHN ↗

Didn't bother at all here either. Great article.

9y agoHN ↗

Awesome! Thanks!

Any chance you want to do one on compression of a integer time series? How about variable length integers? Such an article would be very appreciated in IoT circles since data (timed voltage values) transfer and storage can get quite expensive for dollars and latency.

Cheers!

9y agoHN ↗

This is a fantastic explanation. Thanks! (Also, I love the gifs)

9y agoHN ↗

OP here - I'm seeing 50/50 support for the gifs. I'm keepin my gifs. I like the idea of adding, and will probably implement, a toggle for all extraneous gifs. I love that most of the commentary about this article is about the gifs. Gifs.

9y agoHN ↗

Personally I didn't mind the content of the gifs, it was the fact that they made it difficult to keep track of where you were in the text around them as I tried to read it.

Perhaps some people are less susceptible to this than others.

9y agoHN ↗

I wouldn't mind the GIFs if they were A. smaller (most of them take up a good 2/3rds of the height of my viewport at 1600x900) and B. could be paused. They're humorous at first, but then they're distracting as I'm trying to read the stuff around them.

9y agoHN ↗

the gifs are funny. hacker news is just a bunch of anoraks.

9y agoHN ↗

Awesome, I love Gary's videos, and this is one I haven't seen. Thanks!

9y agoHN ↗

Unless I mis-read or mis-understood you seem to invert the meaning of compression ratio half way through ?

(100 / 200) = 0.5. Protip: compression ratios less than 1 are frowned upon.

Unfortunately, it's not that simple. Say we had an algorithm (let's call it A) that, given any input whatsoever, was capable of achieving a compression ratio of strictly less than 1.

9y agoHN ↗

Yeah came here to point this out, that's definitely an error.

9y agoHN ↗

I did indeed, thanks for the catch - fix incoming

9y agoHN ↗

This is nice! One minor error - 本 does not mean a tree, but a book or a root. 木 would be appropriate for the word 'tree'.

9y agoHN ↗

I caved and added a "toggle pointless gifs" button, history will judge me well

9y agoHN ↗

Thank you. Normally I'd enjoy the "pointless gifs" but they make it hard for me to read your article at work.

9y agoHN ↗

Too late. I finally added media.giphy.com to my UBlock filter. This one put me over the edge, since I couldn't focus on the content.

However, otherwise an excellent introductory article. Got me reading about Shannon, Kolmogorov, and information theory now.

9y agoHN ↗

I highly recommend Stephen King's "On Writing." The basic lesson - if it isn't needed, take it out. Kill your babies.

The GIFs are the "your babies" of this article.

9y agoHN ↗

Great book recommendation btw. On Writing Well by William Zissner is a great one too. Less autobiographical (but the Stephen King bio IS great and inspirational - still recommend)

9y agoHN ↗

Oh, I forgot to do what I always do when I recommend King's book - skip the autobiography at the beginning :P

Maybe if someone really likes King's works it'd be worth reading, but I didn't find it that interesting. I think perhaps if someone wanted to make a career out of writing, it'd be good to get a perspective on what it took him to "make it." Otherwise, eh.

9y agoHN ↗

I quite liked it. The struggle was interesting. Reminded me of The War of Art by Pressfield, but less or more extreme depending on how you look at it.

9y agoHN ↗

I was able to actually read the article because of this. Thanks.

9y agoHN ↗

I actually came here to commend the author for letting me opt out of the nonsense. It may not seem like a big deal for you but the images are distracting to me, require more scrolling in order to reference something that was mentioned previously and do not add anything to your content.

BTW I think your content is great and I imagine you think so to. You commented on the fact that most of the comments were about the GIFs and not the content. I think that should be a not so subtle clue about the value of some lady waving in front of a green screen.

9y agoHN ↗

I read 90% of my content in emacs-w3m, in the terminal, where no images load unless I deliberately want them to. It also has the advantage of getting rid of javascript and most page design nonsense, flash, non-text ads, and various "Web 2.0" annoyances.

The result is beautiful, consistently formatted, lightweight, and perfectly readable plain text (fully integrated with my editor/OS, incidentally).

9y agoHN ↗

This comes close, but I think there was one where one user talked about how they use Spacemacs (Emacs with Vim style editing), and use Org files[1] to bascially plan their life. Meetings, Calendar events, reminders, notes, TODOs, you name it.

[1]: http://orgmode.org/

9y agoHN ↗

Same here.

They also make me see the author as a bit immature (not necessarily true, but still).

9y agoHN ↗

The first example (tree represented in Japanese) seemed a bit misleading, because the "alphabet" has not been kept as a constant. Since the Japanese alphabet is much larger, it may be argued that the number of bits actually occupied in storage by "本" and "tree" are about the same. Could someone clarify if this is correct reasoning?

9y agoHN ↗

One could argue that in information theory terms, there is more information encoded in a single "本" than a single "T".

However, this article is dealing with the concept of compression in terms of a simple symbolic representation of data.

9y agoHN ↗

Certainly, and I deliberately didn't get into bytes and encoding until after this - I was trying to get across the softer idea that in terms of space-on-a-page-using-a-pen, you've saved.

9y agoHN ↗

The pixel art doesn't show up for me in Firefox or Edge. (Looks like they're there, just with a height of 0px?) Also, my motion-sensitive lizard brain thanks you for the gif toggle button.

9y agoHN ↗

Fixed at least on Firefox, please enjoy your pixelly goodness

9y agoHN ↗

Fantastic article. I really enjoyed the inclusion of a live, clickable demo with example output. Absolutely well done (after I disabled the GIFs).

9y agoHN ↗

I toggled the gifs off since I read the comments before the article. I must say, the article is excellent and you could even share it with a non-technical manager or spouse*

*goes ands talks to wife about compression basics :)

9y agoHN ↗

Great article, would be interested in more in depth articles on say, JPEG compression in the future.

Really liked the better/worse thing too, added some nice comparison

9y agoHN ↗

I came here to ask the same. Can anyone recommend more in depth articles about compression?

9y agoHN ↗

It reminds me of how viral images are referred to as memes, often by people who are ignorant of the original and fuller meaning of the term as a viral idea (as opposed to and deliberately reminiscent of the view of a gene being a viral biological entity, as in "The Selfish Gene" by Richard Dawkins, who coined the term "meme" itself).

Of course, the term "viral" is itself used metaphorically here, and is also used as an analogy to a biological entity. But in this case, I think more people are aware of the existence of viruses than they are of the original meaning of the term "meme", though they might not make the conscious connection between a "viral" idea, video, or image and that of a biological virus or how it spreads "virally".

9y agoHN ↗

...because MP4phy doesn't have quite the same ring to it?

9y agoHN ↗

I'm probably getting old because I can't stand this new trend of putting useless gifs (or mp4's actually) every two paragraphs in every article on the web. Oh, and of course all of them have autoplay enabled because sole purpose of my laptop's fan is to happily spin at full speed. </random rant>

9y agoHN ↗

Great article, exquisite gifs. :^)

Including the size of each Obama JPEG could be pretty interesting too.

9y agoHN ↗

Any thoughts on what you'd like to see in particular? Likely to be more of the same interactivity

9y agoHN ↗

I'd like to see some examples of how lossy compression algorithms work

9y agoHN ↗

Once you understand RLE, LZ is only one step away --- instead of repetitions of individual characters/bytes/etc., you encode repetitions of longer strings.

But starting with RLE is IMHO definitely a good choice --- far better than Huffman, as a lot of introductory material seems to do. A minimal LZ12/4 (4KB window, 18B max length; an old favourite of the demoscene intro packers) compressor/decompressor pair is literally a few hour's worth of work, and yields surprisingly good compression for its simplicity, much better than simple order-0 Huffman.

9y agoHN ↗

I really like the article. One point if like to see: you stepped over the fact that your using palettes without mentioning even though that gets you down from using 3 (or 4) bytes a pixel to 1/4. It's a compression ratio of 8 that your completely ignoring!