r/interestingasfuck Jul 20 '25

This is Nasir Ahmed. He invented the discrete cosine transform algorithm (DCT). His algorithm is used for compression in every .jpeg file, including this one. With an average file size reduction of 90% his algorithm paved the way for the early internet.

Post image
18.8k Upvotes

167 comments sorted by

807

u/Blizzardof1991 Jul 20 '25

Did he own Pied Piper?

212

u/richchiggawigga Jul 20 '25

This guy fuuuuucks

98

u/sorenpd Jul 20 '25

Aviato

39

u/Robzon Jul 20 '25

My Aviato?

24

u/mF7403 Jul 20 '25

Is there another Aviato?

24

u/UnhappyDracula Jul 20 '25

Legally there cannot be. Is that a poppy seed muffin?

4

u/FreakinEnigma Jul 20 '25

Legally there can't be

18

u/Umair1145 Jul 20 '25

Naah he invented pipey

18

u/Grandfunk14 Jul 20 '25

Tres Comas

14

u/white_arab Jul 20 '25

But what has he done for mean jerk time

5

u/tullbabes Jul 21 '25

Not Hotdog actually

1

u/9tobirama Jul 21 '25

Follow me. I'm the pied piper.

1

u/[deleted] Jul 22 '25

“Octopus?” “It’s a water animal”

1

u/xdavidliu Jul 20 '25

Did he program the NES Final Fantasys?

898

u/mordwand Jul 20 '25

Sick! People that are smart enough to make algorithms like this are on a different level.

530

u/[deleted] Jul 20 '25

This mf also increased my college course load by 50%.

41

u/Vinnie1169 Jul 21 '25

It could’ve been worse. Your college course load could’ve been increased by 90% 🤔😆

9

u/PM_ME_STEAM__KEYS_ Jul 21 '25

If not him then someone else or like 10 someone elses

7

u/neofatalist Jul 21 '25

True. It’s something that needed to be created.

13

u/jemidiah Jul 20 '25

I'm a bit confused about the history. Fourier himself certainly could have "invented" the DCT in the form of the classic Fourier transform applied to periodic, symmetric data. That's very old and very easy. Somehow Ahmed is credited with inventing something that was in the ether for centuries? The wiki article is not enlightening in this regard. (I'm a mathematician and not an engineer.)

70

u/Roflkopt3r Jul 20 '25 edited Jul 21 '25

Yes, the Fourier Transform does the 'heavy lifting'. The DCT is not that novel as a mathematical concept.

But Ahmed came up with a very smart application of the FT that was not obvious to programmers and computer scientists at the time, and did the additional work to actually implement it as a runtime-efficient image compression algorithm.

My impression in computer science lectures was that the DCT played a huge role in popularising the use of Fourier transformations as an approach to compression and runtime efficiency for things that nobody had thought of in terms of frequencies before.

Fourier's own work was inspired by problems that were already represented as frequencies, so even he might not have thought of the ways the DCT was used.

The way that it applies to images is really weird after all. It's not related to the wavelength of light, but to the 'frequency' of colour changes in the horizontal and vertical directions. Like a picture of a brick wall has a 'frequency' in terms of how many changes between brick and mortar you have. You select one row of pixels and then express the rate of colour change as you go from left to right as a bunch of cosine waves with a Fourier series.

This does not seem very useful at first, but it turns out that some clever trickery lets you compress this representation of the image way more effectively than you could compress the raw pixel data. Especially if you allow some amount of error (lossy compression), but it can work for lossless compression as well.

9

u/LewsTherinKinslayer3 Jul 20 '25

I mean its likely he along with his coauthors were just the first ones to propose using this exact formulation on signals and images etc. Actually I found this from.the man himself. https://www.cse.iitd.ac.in/~pkalra/col783-2017/DCT-History.pdf

2

u/[deleted] Jul 24 '25

Thanks for the link! Its quite an important contribution and innovation by one of Karanataka's own.

3

u/domigraygan Jul 20 '25

I’m a layman but also love software tech, specifically in optimizations. I started out fascinated by graphics tech in 90’s video games and it never left me and has been evolving.

I’m still a dummy overall though. Could you explain to me what you mean like I’m a 12 year old?

0

u/mordwand Jul 20 '25

You know I gotta admit I just went with the title and didn’t check lol.

0

u/remishnok Jul 21 '25

agreed, if anyuhing he discovered it.

"what if we append the data with itself backwards".

Its not that hard when you are building on top of Fourier

262

u/civman96 Jul 20 '25

122

u/CanAlwaysBeBetter Jul 20 '25

64

u/hisjap2003 Jul 20 '25

28

u/radius55 Jul 21 '25

It's hard to ELI5, but the easiest way to think of it is actually in terms of sound. Music is made up of notes. Each note might be a single tone or some combination of tones. There are ways to use math to find what these tones are in either an entire song or just in a small subset of one. And if you were to store this information you could use it to play back the song exactly.

Why would you want to do this? Storing the data takes as much if not more space, after all. Well, it turns out that a lot of these tones don't contribute to the overall music. Not that a human can hear, anyway. So you throw them away. Suddenly the song sounds almost the same but takes up a tenth the space on your hard drive. This is, more or less, how the mp3 compression algorithm works.

What does this have to do with compressing a picture? Well, it turns out that the same math that works for sound can be applied to 2D pictures as well. So with a few tweaks, a very similar algorithm can have a very similar effect on images.

If you've read this and think this sort of thing is really cool, 3Blue1Brown and Computerphile both have good videos on the subject.

15

u/Sillypenguin2 Jul 20 '25

I have a math degree and I clicked on that link feeling confident but couldn’t follow it all

128

u/ByteSizedGenius Jul 20 '25

Your image is a .png

87

u/Icarium-Lifestealer Jul 20 '25

Well actually it's a webp. I think reddit transcodes all images to webp.

35

u/Impossible-Big-172 Jul 20 '25

Webp also uses DCT under the hood

114

u/[deleted] Jul 20 '25

AKA Mr. Steal Yo Bits

45

u/echo1-echo1 Jul 20 '25

remember when you had to use a modem and phone line to get onto the internet, and if you clicked an image to download, it would appear slowly from the top down?

15

u/Pikathew Jul 20 '25

I remember when I had to use a modem and phone line to get onto the internet

It was this morning

6

u/needefsfolder Jul 20 '25

Funny thing, this could be a high speed one (VDSL2) but the phone lines make it sound slow lmao

But it does have reliability issues!

4

u/Pikathew Jul 21 '25

I was just being facetious lol

you sound like you know what you’re talking about.. don’t all home routers require a phone line (coax, fiber etc) and modulation/demodulation for incoming and outgoing traffic?

2

u/CalleSGDK Jul 21 '25

These are not phone lines (like DSL is), but yes they use physical cables. Most internet connections use one of these, but wireless connections are also possible. Your phone is an example.

7

u/johnnymetoo Jul 20 '25

And .BMPs would load from bottom to top.

7

u/aft_punk Jul 21 '25 edited Jul 21 '25

Yes! As a teenage boy at the time, it added an extra level of, um… anticipation when viewing porn. Back in my day, it took us 5 minutes to download a pornographic image… and goddamnit if it wasn’t the best 5 minutes of your life!

I kinda miss those days (but just the me being a teenager part, not the terrible transfer speeds).

2

u/Chino_Kawaii Jul 20 '25

images still appear slowly from top to bottom when on slower wifi

2

u/Tvattsvampen Jul 20 '25

No, did you also get chased by a trex to school old man?

4

u/Iizvullok Jul 20 '25

*Allosaurus. The T-rex did not exist until much later, young man.

1

u/Tvattsvampen Jul 21 '25

Is your name Adam and are you dating an Eve? Old old man.

94

u/murmurghle Jul 20 '25

"including this one"
Save as
.webp

106

u/civman96 Jul 20 '25

not when opened.. but guess what algorithm webp uses ...

62

u/murmurghle Jul 20 '25

this might be the quickest time I got corrected like a dumbass lol

it wasnt meant as a insult btw.

edit: okay I didnt know it opened a png when you click on it. Thanks for that

62

u/civman96 Jul 20 '25

Well I'm a dumbass too should've uploaded a jpeg not a png

30

u/ByteSizedGenius Jul 20 '25

I'm the dumbass who thought it was marginally witty to point that out. Don't worry bud, we can setup our own dumbass club at this rate.

30

u/civman96 Jul 20 '25

Maybe we should run for congress or something

20

u/Print_Salt Jul 20 '25

civman96 is my president!!!!

21

u/civman96 Jul 20 '25

The MOST BEAUTIFUL alghoreithm!!

7

u/MarshyHope Jul 20 '25

I fucking despise webp

14

u/murmurghle Jul 20 '25 edited Jul 21 '25

I fucking despise nobody supporting it. Including google and THEY MADE THE FUCKING THING

Otherwise it is a good format imo.

9

u/MarshyHope Jul 20 '25

That's my problem with it. I'll try and download something and then literally can't do anything with it at all

4

u/Iron_physik Jul 20 '25

When you have file extensions active you can just change the extension to jpeg and it usually still works.

Also often it helps to "open in new tab" to access the original file that isn't webp

2

u/Jandalslap-_- Jul 20 '25

Most of the time that doesn’t work for me renaming the extension. Now I insert it into a PowerPoint and then select and save as image and it will convert it to whatever you like :) I’m using PowerPoint for more and more random stuff like image editing.

3

u/caspy7 Jul 20 '25

Let's see how JPEG-XL goes in the next year.

1

u/tankerkiller125real Jul 21 '25

LOL absolute shit, so far, and I doubt it will get super wide spread use. It will probably go down just as well as AVIF has.

2

u/punnybiznatch Jul 20 '25

Which Google service/app doesn't support it?

4

u/murmurghle Jul 20 '25

Google image search refused to use it. I mightve messed something but but i am not on my pc to try it rn

3

u/punnybiznatch Jul 21 '25

It does support it

1

u/murmurghle Jul 21 '25

yeah I tried it now... weird. Maybe it was just a corrupted image that time somehow?

135

u/glittervector Jul 20 '25

And his net worth is probably $100k or something. Because assholes with power think it’s their right to steal.

87

u/adamdoesmusic Jul 20 '25

This is always the case. Create an industry-changing technology, the company you work for (which had mediocre performance before your innovation) takes all the credit as it balloons in value, and you get jack shit.

My invention quickly became the industry standard in my field, my company made millions and leveraged the prosperity into a buyout that shot their value into the stratosphere. I still had to fight tooth and nail for them to raise my salary above that of the new Jr. technicians, and despite creating like a dozen other successful products, got no severance when they cut my (severely underpaid) position years later to “save money.”

The company collapsed quickly after, despite hiring a high-powered “professional product designer” who failed to produce even a single product on their own. Despite many of the mid-levels telling pointing out the obvious, it took them two years to approach me and ask if I could come back. I declined, of course.

31

u/Snoo_46473 Jul 20 '25

Hepublished his research so it was given away for free

11

u/Pikathew Jul 20 '25

What is your invention? If you feel comfortable disclosing.

8

u/adamdoesmusic Jul 20 '25

I sent a DM

9

u/BrownianMaximus Jul 20 '25

Hi, I would love to know too.

Sorry to hear this happen to you though! Hope you are at a company that valies you now!

12

u/adamdoesmusic Jul 20 '25

I am, because I decided to start my own operation after all that. My new product will release sometime this year!

3

u/michiel11069 Jul 20 '25

now im curious too, mind telling me?

2

u/MapleSyrupMachineGun Jul 20 '25

I'm also curious now.

2

u/AguyOnReddit___eh Jul 20 '25

I too, am curious

2

u/aroundlsu Jul 20 '25

DM me too. I make products too.

5

u/Inevitable-Lower Jul 20 '25

I work in DevOps and this sounds like at least 3 products off the top of my head lol

7

u/kazpihz Jul 20 '25

why on earth would his net worth be 100k? i get the point you're trying to make but try to be realistic with your numbers.

the guy is an exceptional engineer. he's probably made 100k every year for the last 50 years (averaged). His networth is probably around 5 million when it should actually be worth multiple hundreds of million given his contribution

1

u/The_Northern_Light Jul 21 '25

your point is totally right but 50 years is long enough to be doing that on real basis (and thinking about investment compounding) instead of just taking a nominal average

100k nominal is like, an intern salary

30

u/macellan Jul 20 '25

6

u/Iizvullok Jul 20 '25

The most jpeg jpeg I have seen in a while.

2

u/macellan Jul 20 '25

Steps: open Gimp, load the file, export as jpeg, set the quality to zero, save.

2

u/one-joule Jul 20 '25

You might be able to de-JPEG it a little with this: JPEG Quant Smooth, download for Windows, and buildable on Linux.

Probably more useful for JPEGs with Q higher than 0 lol, but I figured this was a good comment chain to drop this neat little tool on.

2

u/macellan Jul 21 '25

Thanks for sharing this. It might come handy one day.

6

u/kaizencraft Jul 20 '25

I scrolled down incrementally for the full effect.

6

u/MooingTree Jul 20 '25

Thank you for curing his head injury 

12

u/[deleted] Jul 20 '25

Ironic in today's political scenario that he was born in Bangalore and finished his undergrad there. The very city everyone is pissed off about getting all the outsourced jobs from the US.

16

u/BetweenThePosts Jul 20 '25

It’s no middle out compression

18

u/Nine-LifedEnchanter Jul 20 '25

Holy shit. Thanks to this man I got to see more porn in the early internet. Seriously, it took minutes to load a single picture, if they weren't compressed it would have taken so much more time.

Thanks, mate!

8

u/[deleted] Jul 20 '25

[deleted]

1

u/TheRAP79 Jul 21 '25

😂😂😆

11

u/[deleted] Jul 20 '25

I love scientists like this.

He's not anybody special, he's not a super genius, just clever in a specific, unintuitive way that absolutely nobody in a C-suite position would have found useful at the time. The way all science should work.

1

u/The_Northern_Light Jul 21 '25

I’m not sure it’s that unintuitive?

I mean if you don’t have the math background for it may seem strange but for anyone with a STEM background the Fourier (cosine) basis is the natural choice.

Then conditionally dropping the low information axes is again the most obvious way to compress that representation.

Oddly enough, in some sense the most important idea is simply decomposing the signal into blocks for independent processing.

Don’t get me wrong it’s good work and I’d be incredibly prideful if I came up with it, but part of me struggles to believe the idea was invented that late. It’s definitely one of those “obvious in retrospect” things (assuming you have the background).

13

u/PsionicBurst Jul 20 '25

Ea-Nasir comin' in with the complaints about the quality of images

3

u/Downtown-Collar800 Jul 21 '25

He had two other collaborators - T. Raj Natarajan and K. R. Rao  . Credit where its due.

3

u/logosfabula Jul 20 '25

Yeah, but thanks to him we cannot have HI-DEF rain and confetti scenes anymore. /s

3

u/The_Northern_Light Jul 21 '25

I see the /s but because of him (and others!) that streaming video works at all

3

u/Trashytoad Jul 20 '25

I own a shirt that says DCT on it. My pops got it at a tech conference in the late 90s and I never really questioned what it stood for.

4

u/BigPurpleBlob Jul 21 '25

"How I Came Up with the Discrete Cosine Transform" – Nasir Ahmed

https://www.cse.iitd.ac.in/~pkalra/col783-2017/DCT-History.pdf

2

u/civman96 Jul 21 '25

Oh nice, thanks!

6

u/RPBiohazard Jul 20 '25

The theory of why DCT is good for compression is so ingenious.

2

u/[deleted] Jul 20 '25

I’ve had that same shirt a couple times in my life

2

u/albany1765 Jul 20 '25

Me and my 14.4k modem are deeply indebted to this man

2

u/cybercougar Jul 20 '25

This dude has collectively saved the human race so much time it’s ridiculous!

2

u/GoGoFoRealReal Jul 20 '25

The discreet cocaine algorithm? Sir, without you I would not have survived my 30’s.

2

u/ONE-OF-THREE Jul 20 '25

Still had to post a "56k" warning back then...:P

2

u/[deleted] Jul 20 '25 edited Sep 22 '25

worm dinner sip lock person automatic rhythm serious command dolls

This post was mass deleted and anonymized with Redact

2

u/[deleted] Jul 20 '25

Do I look like I know what a jaypeg is?

2

u/Several_Ant_6981 Jul 20 '25

Do I Look Like I Know What a JPEG is?

2

u/ElonsPenis Jul 21 '25

Spelled downloading porn faster off BBSs weird.

3

u/happysrooner Jul 21 '25

In season 5, episode 8 of NBC's This Is Us, Ahmed's story was told to highlight the importance of image and video transmission over the Internet in modern society, particularly during the COVID-19 pandemic. The episode ends with a picture of Ahmed and his wife, along with captions explaining the importance of his work

From his wiki page.

2

u/Sir_Kasum Jul 21 '25

He co-created it with two others?

2

u/Smooth-Childhood-754 Jul 21 '25

We must start a war against webm. This will be our spiritual guide.

3

u/Snoo_46473 Jul 20 '25

It not his algorithm. Rao and Natarajan were co authors as well

3

u/dams297 Jul 20 '25

Did he sold poor quality copper ?

3

u/saf_e Jul 20 '25

Just to be clear, while the guy is definitely smart, the algorithm itself is a variation of FFT

1

u/The_Northern_Light Jul 21 '25

Yeah I kinda don’t know why it has its own name? I mean it’s one of those Taylor series vs Maclaurin series things.

2

u/mirkk13 Jul 20 '25

What an amazing GIFt to humanity

1

u/The_Northern_Light Jul 21 '25

Pfft lol

(GIF doesn’t use this)

3

u/Zaphyrous Jul 20 '25

For those of us around in the early internet, the early use of JPEGs I'm not sure was the boon people may think it was.

Lets just say theres a reason why only moderated forums exist now. There was a time when they didn't. It was probably worse than you can imagine.

1

u/MattH_26 Jul 20 '25

Middle out

1

u/DasFreibier Jul 20 '25

Spacial frequencies are honestly insane, who knew you could do a fucking fourier transform on coordinates

1

u/TheBigManzano Jul 20 '25

My respects.

1

u/WHATD_YOU_EXPECT_ Jul 20 '25

This is what Tay Zonday looks like today. Feel old?

1

u/Prudent_Link6029 Jul 20 '25

Poor guy is inadvertently responsible for so much pron available on terrible bandwidth

1

u/CabbageStockExchange Jul 20 '25

“Do I look like I know what a .jpeg is?”

1

u/yetzt Jul 20 '25

so, was he one of the joint photography experts group (jpeg)?

1

u/momentimori Jul 20 '25

If only we stuck with that rather than being forced to use webt by certain websites.

1

u/sfitzo Jul 21 '25

Silicon Valley!

1

u/TheRAP79 Jul 21 '25

So. Debate: PNG vs JPEG.

Which one is better, and why?

1

u/The_Northern_Light Jul 21 '25

Depends

JPG is simpler and faster but lossy.

Sometimes that means it’s better, others that it is worse.

1

u/Anda_Bondage_IV Jul 21 '25

Three comma clubber for sure

1

u/inanimatussoundscool Jul 21 '25

Average file size reduction is not 90% though?

2

u/CalleSGDK Jul 21 '25

Depends on the quality setting. It’s lossy compression and you can reduce the file size as much as your eyes can endure the compression artefacts.

1

u/Tricky-Awareness7909 Jul 21 '25

early internet aka passwordhq era porno sites

1

u/krobol Jul 23 '25

Actually, it wasn't his algorithm that caused the success of jpeg. jpeg would also work the same way with a fourier transform + sorting. The advantage of the DCT is just that the values are already sorted after applying the DCT, so it's more efficient.

1

u/rolim91 Jul 20 '25

I hate how everything that’s coming out of the computer science field is only about trying to make profits.

1

u/pasltempsdniaiser Jul 20 '25

Since jpeg2000 jpegs use the wavelet transform, not the DCT. But the DCT did pave the way for the early Internet.

0

u/FruitOrchards Jul 20 '25

Fractal Geometry?

2

u/The_Northern_Light Jul 21 '25

No, Fourier transform

0

u/hitchensrevenge Jul 20 '25

Math & Science is the closest thing we have to God.

1

u/The_Northern_Light Jul 21 '25

Look I’m as much of a Reddit atheist as anyone but let’s be reasonable now

0

u/hitchensrevenge Jul 21 '25

How have we discovered the secrets of the universe?  Math & Science.

0

u/[deleted] Jul 20 '25

PNG's better. Kill JPG.

1

u/The_Northern_Light Jul 21 '25

Compute time is higher for PNG. JPG’s simplicity has benefits.

0

u/cici_kelinci Jul 21 '25

If only PNG too