Here are the ways by which you can optimize an image in a website for fast loading:
1) Re-use the same image: You should always re-use the same images as an image is downloaded only once in a browsing session. If you have many similar icons to display in a page with different files, then, the ideal approach is to use a single icon for a particular task. For Example, if it is a download icon then there should be only one image file for a download icon. This image file can be used again wherever a download icon is required.
2) Reduce the size of the image: You should always reduce the size of the image to the minimum possible level. This way, your images will download fast. While resizing you have to make sure that the image is looking fine in the browser.
3) Flatten colors: You can also reduce the color palette of an image by flattening it. Use of less colors in an image means that the size of the image will be lesser. However, you need to make sure that the image quality is not sacrificed to a visible extent.
4) Reduce color depth: Color depth is the number of maximum colors an image format can have. For example: GIF format has a maximum color depth of 256 colors known as 8 bit color. Here, 8 bit is the maximum color depth of GIF image. This can be reduced to 7 bits, 6 bits and so on. Again you have to make sure that the quality of the image remains intact when you are reducing the color depth.
5) Use of web colors: Web colors are the set of colors especially used for the web. If you are creating an image create one using web colors so that your image will look same in all browsers.
6) Image cache: Caching the image can greatly improve the loading speed of the website. By using a cache for the images, images are only loaded one time, the next time it is loaded from the cache, thus improving the loading speed of the website.