I highly recommend writing a JPEG en/decoder as an exercise in coding; getting to the point of being able to decode almost all the images you probably have or can find on the Internet shouldn't take more than a few hours and <1k lines of (C) code. Once you've done that, you'll be ready to take on a simple video codec, like H.261. I find it self-motivational because the results are very visible (and if you have a bug, all sorts of fun effects can appear too.)
(As you may have guessed, I've written a JPEG decoder, as well as JBIG2 (partially), H.261, and MPEG-1, each of which is roughly 1kLoC. Currently thinking of trying JPEG2000 too, which is over an order of magnitude more complex.)
Interestingly enough, the JPEG2000 spec is at first glance not that much longer, but it is far more terse, so the size of the spec is only a rough estimate of the complexity and work it'd take to implement.
By contrast, PNG, which also uses Huffman codes for image compression via DEFLATE, has both length fields and integrity checks (CRC32), which the majority of decoders will check. Hence, almost any corruption to a PNG will render it invalid. If you fix up the length and CRC fields after tampering with the file, you can glitch PNGs too, which can produce some very interesting effects.
People always say that nothing good can come out of a committee. JPEG proves the opposite.
I do hope that new alternatives like BPG, HEIC or WebP displace JPEG someday - but that day promises to be very far into the future.
Webp is royalty free, but for lossy compression it's not a good enough improvement (imo) over jpeg for it to replace it. For lossless compression though, it beats PNG both in size and compression/decompression speed by a good margin.
As for potential jpeg replacements, we have AVIF which is like BGP,HEIF but with the royalty free AV1 codec: https://aomediacodec.github.io/av1-avif/
And the other one I find very interesting is PIK, which is a new lossy/lossless codec that is supposedly a good improvement over jpeg while being very fast, and also has the feature of being able to losslessly recompress jpeg images into pik with ~20% compression: https://github.com/google/pik
On the MP3 side, current LAME is a lot better than the encoders we used back then.
It’s indeed not super easy on macOS, I imagine you’d use a website to convert it or get ImageMagick through brew. On Windows I wonder if the photo app supports it, in which case you’d hopefully just double click the image and then save a copy, but unfortunately I cannot try that right now.
I think ideally Slack should be able to convert on the fly, just like creating low quality versions for thumbnails. It’s a paid service after all! But that doesn’t change the current predicament.
I personally too use PNG for graphic, and JPG for pictures even today, despite Lighthouse suggesting I add WebP extras. It’s just so much easier and more portable with so little to gain by doing it.
I ended up using an online converter  as Gimp and Imagick wasn't having any of it (at the time). Someone in these comments suggested using ffmpeg as an alternative.
> I think ideally Slack should be able to convert on the
> fly, just like creating low quality versions for
> thumbnails. It’s a paid service after all! But that
> doesn’t change the current predicament.
I would mostly agree with you, but these days I'm easily pleased when these types of services do the simple things well. They are only really incentivized to support the most popular image types anyway.
> I personally too use PNG for graphic, and JPG for pictures
> even today, despite Lighthouse suggesting I add WebP
> extras. It’s just so much easier and more portable with so
> little to gain by doing it.
This is what really answers why we still use them, it's convenient. To the average user, the difference between 90kB and 80kB images is not worth losing sleep over. If you were serving that image several million times a day I could imagine it's slightly more pressing.
As an aside I sometimes use my Sony Mavica (floppy disk camera) and that thing outputs valid JPEGs that I can upload to anywhere. (I use it as mostly a joke, but I also love the idea of having a limited number of pictures and keeping old tech going.)
And it should also be available from both Homebrew and MacPorts.
To convert a .webp image, use dwebp foo.webp -o foo.png
WEBP files dragged from Mac chrome just fail silently and never appear on the desktop so now I have to pay extra attention every time.
Although I’m sure the server owners enjoy the benefit, but if it doesn’t work Like a jpeg and I have to change my workflow for an image format then it sucks for the user.
For Audio, Over the last 25 years We had WMA, Real Audio, Vorbis, MP3 Pro, HE-AAC, these are some well knowns ones, and all of them promised to have MP3 128Kbps quality at half the bitrate. And none of them were even close. Not even at ~100kbps. It was until Opus, and after much tuning of its v 1.3 encoder, did manage to finally edge out LAME MP3 128Kbps with 96Kbps.
I hardly see that as much better audio compression in 25 years time. However we could definitely get much more ( 20 - 30% ) quality out of 128Kbps or 256Kbps with AAC or MPC ( MusePack, my favourite high bitrate Audio codec )
And yet during this time Consumer Internet speed went from a dismal 56Kbps to 10+Mbps, and for many it could be 100+Mbps. That is a 100 to 1000x difference.
For image, while BPG and newer image format do get 50% reduction from JPEG, but consider our display resolution is now 4x to 8x of JPEG era. 50% reduction aren't anywhere enough. I would like to see one that gives same quality of the current JPEG at 25% of file size. I.e 100KB JPEG to 25KB.
Although I am not entirely sure will it matter. It wasn't the Format that is good enough, it is that our Network Bandwidth and Storage has grown at a pace that makes them irrelevant. Compared to the unknown and research required to make those file size reduction, we have a very clear path in 5G evolution, apart from Africa which I am not so sure, Most of North, South America, Europe, Asia will be able to afford 5G Mobile plan with at least 10Mbps Real World Speed by 2030. And I would not be surprised many of the more advanced nation will get 100Mbps or even 300+Mbps in real world usage.
Note: Before anyone mention DataCap, I think 5G with much higher capacity will change the economics of Mobile Data.
But at the cost of much higher complexity. The "magic" about JPEG is the results that it is able to deliver despite its simplicity.
Created by the same person who created FLIF!
Better yet, it's probably the most-likely technology to be accepted into the upcoming JPEG XL standard!
Lossless encoding can be far simpler to understand (in some cases it's not, see FLAC).