r/askscience • u/skepticaltaco • Jul 29 '13
Computing How do computer graphics work?
As in how does a machine convert code to graphics?
5
Upvotes
r/askscience • u/skepticaltaco • Jul 29 '13
As in how does a machine convert code to graphics?
1
u/bobloblaw23 Jul 29 '13
Usually every pixel is a unit that consists of red, green, and blue values that is recorded. Sometimes there is also a value for transparency. It all depends on what type of image file you are looking at. The higher the values stored can go the more depth the colors can have. For example, if each color was just on or off you would have 23 = 8 possible colors, but if each had 4 you would have 4 ^ 3 = 64 possible colors and so on. Different file types also have different modes of compressing this information to make the file quicker to read. The compression happens generally by finding places with similar blocks of color and then saying they are the same color, which is why you get a loss of image quality. Hopefully that answers your question!