When uploading image files to Wikipedia it is important that the file sizes be as small as possible. This facilitates faster downloading and also saves space on the server. But how can you ensure that the image really is as small as can be? The first thing to consider is the format. Let's assume that you have a diagram drawn by yourself using some kind of vector graphics editor, or a .bmp file. This way you have a free choice on what compression you can use. The basic choices are PNG or JPEG
|
For Diagrams You should use PNG (Portable Network Graphics). This compression algorithm is designed to work with large areas of solid colour that have sharp boundaries. It is therefore a good format for diagrams and cartoons. But it does not automatically give you the smallest possible file size. There are some things that need to be done manually.
Does the diagram contain a title within it? If so, consider whether it would be better to remove the title and add a caption to the image instead like this.
A title as a caption under the image |
|
Smiley face with title.png 1496 bytes |
Smiley face with no title.png 1012 bytes (+74 bytes caption) |
---|
Does the number of colours fit with the number of bits per pixel? In a diagram, there is usually a limited number of colours. If there are say 4 different colours, there is no need to save in a compression that is capable of distinguishing 16 million colours. To distinguish millions of different colours requires 24 bits per pixel;
1 bit colour (180 bytes) | 4 bit colour (309 bytes) | |
No antialiasing | Antialiased | Enlarged view |
256 different colours only needs 8 bits;
This means that 8 bit colour file sizes would theoretically be 1/3 as big as 24 bit colour.
For a black and white diagram you may be able to use only 1 bit colour;
However if the image is anti aliased you will lose it.This is because antialising smooths jagged diagonal edges by adding various shades of grey where once there was black or white. Anti aliased b/w images can be saved as 4 bit 16 colour images instead.
Why you should not save diagrams as JPEG To the right is an example of a file saved as a JPEG when it should have been saved as a PNG. JPEG uses a lossy compression algorithm meant for photographs. Compressing drawings or diagrams with JPEG results in an image of poor quality, because the human eye can spot the artifacts around the edges.
Another drawback is the large file size you will end up with. JPEG compression has many options but most commonly only two color spaces, 24 bit (millions of colors) and 8 bit (grayscale), are used. In the sample on the right a 4 color image is inflated by using an inappropriate color schema, which results in the rather large file size.
If you don't have an original file, but only have a jpeg file that really should be a png, you should not simply save the jpeg as png because this will result in an even larger file size. There is a nice tutorial here Wikipedia:How to reduce colors for saving a JPEG as PNG
For Photographs
As stated above JPEG (Joint Photographic Experts Group) was developed with photographic images in mind. Although the JPEG algorithms are quite good there are a couple of tips that will help to get the smallest file size possible without sacrificing quality:
Search Encyclopedia
|
Featured Article
|