At the basic level, all digital images are made up of tiny squares called pixels. A pixel (short for "picture element") is the smallest part of an image that can be displayed or edited.
Pixels: Think of them as tiny building blocks that come together to form a larger image.
Resolution: The resolution of an image refers to how many pixels it contains. For example, an image that is 100x100 pixels means there are 100 pixels across and 100 pixels down, giving you a total of 10,000 pixels.
The more pixels an image has, the higher its resolution, meaning it can display more detail. But higher resolution images also take up more storage space and may require more processing power to display, which can affect the performance of your game.
Understanding how images are represented helps you make better choices for your game’s art. Whether you're working with pixel art, sprites, or backgrounds, knowing how resolution works will help you:
Optimize performance by balancing image quality and file size.
Make smart choices about how to design and store your game’s artwork to ensure it runs smoothly.
Create efficient animations that look good without slowing down the game.
Pixel art is a type of digital art where images are created by manually arranging individual pixels to form pictures. It's commonly used in 2D games because it’s simple, nostalgic, and can run smoothly on most devices.
In pixel art, each pixel is carefully placed to represent parts of the image. Since there are fewer pixels, the art often looks blocky or "retro," which is part of its charm.
Limited Colours: Pixel art typically uses a small set of colours (known as a "palette") to keep things simple and consistent.
Blocky Appearance: Due to low resolution, pixel art can look blocky, but that's exactly what gives it that classic video game feel.
Resolution and Quality: The higher the resolution (the more pixels an image has), the sharper and more detailed it looks. For example, a high-resolution image might look clearer and more realistic, with lots of fine details. On the other hand, a low-resolution image can look blurry or pixelated because there are fewer pixels to work with.
Resolution and File Size: More pixels mean more information, so images with higher resolution take up more storage space. This is important for game development because large images can slow down your game or increase the amount of storage needed to keep the game running smoothly. For example, a 500x500 image has 250,000 pixels, while a 100x100 image has only 10,000 pixels.
Example:
A small image (e.g., 100x100 pixels) might look pixelated but load quickly and take up less space in your game.
A large image (e.g., 1920x1080 pixels) looks much clearer, but it will take up more memory and can make your game run slower if there are too many of them.
Let’s say you have an image that is 3 pixels wide and 3 pixels tall, and each pixel uses 8 bits to store its colour.
For each pixel, the computer stores 8 bits (1 byte) to represent the colour. This means it needs 3x3 = 9 pixels, and each pixel takes 1 byte.
So, the total size of the image would be 9 bytes (for a 3x3 pixel image).
If you wanted to increase the resolution to 6x6 pixels, the image would have 36 pixels, and the size would be 36 bytes. As the image resolution increases, the file size grows rapidly.
When a computer displays an image, it doesn't see "pictures" like we do. Instead, it stores and processes images as numbers in a system called binary. Binary is a number system made up of just 0s and 1s. Each pixel in an image is represented by a number that tells the computer what colour to display.
For example:
A black pixel might be represented as the number 000000 (in binary), meaning no colour is present.
A white pixel could be represented as 111111, where the numbers represent the maximum intensity of red, green, and blue (RGB) light.
To represent more complex colours, the computer uses a combination of binary numbers. Most digital images use a colour system called RGB, where each colour is made by mixing different amounts of Red, Green, and Blue light.
Each of these colours is assigned a number (usually from 0 to 255), so a single pixel’s colour could be represented by something like RGB(255, 0, 0) for bright red. In binary, this would be written as 11111111 00000000 00000000.
Different image formats (like JPEG, PNG, and GIF) store the binary data of an image in different ways:
JPEG: A format that reduces the file size by simplifying the image and losing some of the details (this is called "compression"). This makes JPEGs great for large, high-quality images like backgrounds but can make images look blurry if compressed too much.
PNG: This format keeps all the image detail (called "lossless compression") but tends to be larger in file size. It also supports transparency, which is useful for sprites in games.
GIF: Often used for simple animations. It supports a limited colour palette (only 256 colours), which keeps the file size small but limits the colour detail.
Pixel: A small square that forms part of an image.
Resolution: The number of pixels in an image; higher resolution means more detail but larger file size.
RGB: A colour system using Red, Green, and Blue to make all other colours.
Binary: The system of numbers made up of 0s and 1s that computers use to store data.
File Size: The amount of memory an image takes up. Larger images (higher resolution) have larger file sizes.