eli5 How are pictures and images literally written on a drive

972 views

I know this is ultra general, but Ive always wondered how pictures or sound is written to a drive. I understand slightly that data is stored as little bits of sequences of on or off switches, but if you were to write out a drive in english what would that look like for pictures. Does each pixel have a specific code like the #F000F4 or however you see them online? Hope there can be some sort of minor explanation. Thanks.

In: Technology

6 Answers

Anonymous 0 Comments

The exact details of how it’s written depends on the file format (hence why there’s different ways of saving images, like as a .png or .jpg), but essentially no matter what you’re saving (whether it’s a picture, or a sound, or plain text), you have to represent it as a series of numbers, then translate those numbers to binary and store those in the “on/off switches.” Because we use standardized file formats, someone else can then translate those numbers back into what they originally were.

>Does each pixel have a specific code like the #F000F4 or however you see them online?

You’re not far off here. The standard way of representing a color is with three numbers between 0 and 255 to represent how red, blue, and green the color is. When you see something like #F000F4, that’s actually all three of those numbers written in a shorter way using hexadecimal, which is a base-16 number system. #F000F4 translates to 240 (from the F0) red, 0 (from the 00) green, 244 (from the F4) blue.

There are a lot more details that go into file formats, like compression (because ideally you don’t want to store those three numbers for every single pixel if you can help it), but that’s the conceptual basis. You store the numbers that let the program reading it recreate the color of each pixel.

You are viewing 1 out of 6 answers, click here to view all answers.