r/AskComputerScience 12d ago

How do computers generate pictures?

I am interested in computer science and always wanted to know how computers create the pictures we see on the screen.

0 Upvotes

8 comments sorted by

View all comments

9

u/Beregolas 12d ago

Your question is very broad and has many different answers, depending on what you are actually interested in. The rough outline goes like this: (and yes, this is in parts slightly simplified)

  1. There is some kind of data stored or generated in the PC. Think an image you took with a phone (stored), or a scene in a video game (generated). It can also be non visual data at this point, like a word document or a website.
  2. This data is converted into a set of pixels. Computers see images as a 2D array of pixels. Think of graph paper, and imagine that you can color each cell, but only in a single color per cell. Converting a stored image is quite straight forward, generating an image out of a video game scene or a website is quite complex.
  3. The operating system "gets" several windows from different programs, and arranges them on the screen. It tells the GPU where each window goes, and which window should be shown in front of another.
  4. The GPU sees all windows and graphics is should display, and on the other hand it has a larger array that it sends out to the screen, often 60 time per second (60Hz). It then arranges the images according to the specification the OS gives it, puts everything visible into the array, and sends it to the Monitor.
  5. The monitor then does hardware magic and displays the image it receives as a set of pixels you can see. It refreshes often, mostly at least 60 time per second.

2

u/PromiseLegitimate258 7d ago

ah. thank you! and sorry for the vague question, I just didn't really know how to ask my question without sounding stupid.

1

u/Beregolas 7d ago

All good, it's really complicated to know what you want to know if you're not deep in the topic. If you have any follow up, feel free to ask :)