Palettes can other numbers of colours, usually powers of two so “ n-bit colour” uses up to 2 n colours. That's more than a third of the original size (probably because of the overhead of storing the palette information and some other overhead), but a significant savings. When converted to 8-bit colour and saved, it was 19 kilobytes. When the screenshot above was saved as a 24-bit PNG image, it was a 36 kilobyte file. In this case, each pixel takes about 1/3 of the storage space of a true colour image (8 bits instead of 24). The largest palette usually used in images contains 2 8 = 256 colours and is called 8-bit colour. It is also possible to choose fewer colours for an image file: the file contains a palette of colours that it will use, and then for each pixel, the image must indicate which of the palette colours is to be used. However, the 36 kilobyte PNG file mentioned above was saved with 24-bit colour because it was the default. Using 24-bit colour for an image like the screenshot above isn't necessary, since there are only a few colours there. If you look back at Colours in CSS, there are 2 24 choices for the 6-character colours: it's the same set of colours in either case. The drawback is that there is a lot of information for each pixel and file sizes tend to be large. This is enough to represent images like photographs that have many shades of colours used in their pixels. The reason for the name “24-bit colour” is that each pixel can be any of 2 24 possible colours. This is called 24-bit colour or true colour. The default for most image editing programs is images with a full range of colour for each pixel. In the figures above, we can see that there are relatively few colours actually used: white, black, and a few greys (and a few shades of blue for the link, which isn't in the enlargement). This is determined by how many choices there are for the colour of each pixel. One factor that has a large impact on the size of a bitmap image file is the amount of information that much be stored for each pixel. Saving the screenshot as a PNG, I got a 36 kilobyte file: much smaller than without any compression, but we can do better if we actually understand a little more about images. PNG uses data compression to represent images in smaller files with no loss in quality. We can instead save an image as a PNG ( Portable Network Graphics) which is common on the web. The BMP format isn't used on the web because it produces such large files. That is a lot for a relatively small image. If we save the original screenshot in that format the result is a 526 kilobyte file. The BMP ( Windows Bitmap) format simply records the colour of each pixel with no compression (typically). Of course, the way the computer represents that information isn't english descriptions like that, but the basic idea is the same. Essentially, that information is “Row 1: white pixel, white pixel, white pixel, … Row 2: dark grey pixel, black pixel, black pixel, dark grey pixel, …”. When the computer stores this bitmap data on disk (or transmits it over the Internet), is basically has to store the colour of each pixel. We can add a grid to make the individual pixels more clear: Detail with a pixel grid Let's take a closer look at the first few characters in the first paragraph: Detail of screenshotĪs we expect, the image is made up of a grid of pixels. Since the image is a screenshot and computer displays inherently display bitmaps, this should be saved as a bitmap (not vector) image. Let's return to the screenshot of the sample web page from Attributes and More: Sample web page screenshot
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |