~ Office Supplies ~~ Buy Posters ~~ A-Z Products ~~ Website Advertising


Wikipedia:How to keep image file sizes as small as possible - Wikipedia

<<Up     Contents

Wikipedia:How to keep image file sizes as small as possible

This tutorial comes about after a discussion on :Image:Covalent.png talk page.
 
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

Table of contents showTocToggle("show","hide")

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 antialiasingAntialiased   Enlarged view

224 = 16 777 216

256 different colours only needs 8 bits;

28 = 256

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;

21 = 2 colours (one of which is black the other white)

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.


Smiley face example true C . jpg
4905 bytes

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:

See also

wikipedia.org dumped 2003-03-17 with terodump




 
 
Orange Mexican Potch OPAL gem stone jewel Loose faceted cut jewelry gemstone 8x6 mm single 8x6mm ov
 Orange Mexican Potch OPAL jewel Loose ed cut jewelry 8x6 mm single 8x6mm ov 
 
100 ctw unknown RED GARNETS gem stones Faceting cabbing rough crystal Tiny melee accent up to 2 ct
 100 ctw unknown RED GARNETS ing cabbing crystal Tiny melee accent up to 2 ct 
 
SS .925 Sterling Silver 18" inch box chain 1 mm for gemstone jewelry pendant necklace spring clasp
 SS .925 Sterling Silver 18" inch box chain 1 mm for jewelry pendant necklace spring clasp 
 
28 carats cts Tigereye yellow gold TigerIron Jasper gem tumble polished Cabbing cab tiger iron rough
 28 carats cts Tigereye yellow gold TigerIron Jasper tumble polished Cabbing cab tiger iron  
 
Red green AMMOLITE gem stone Freeform cabochon cabbing jewelry rough Ammonite opal 10 carats 2 grams
 Red green AMMOLITE Freeform cabochon cabbing jewelry Ammonite opal 10 carats 2 grams