Why use .PNG image format for stock chart captures instead of .JPG or .GIF?

If you are like me that keep a detailed trading journal in a blog or in a computer, then capturing technical analysis charts (assuming you use TA) is an essential historical record of your trades. I was saving my charts in JPG format for many years because that's also what my digital camera used. So I used it without giving much thought. It wasn't until one day when I realized my saved charts were slightly blurry that I gave the issue of image format more thought. After some research, I found out that not all image formats are created equal. Not only do they differ in compression level, they also differ in their quality and intended use. This post is intended to summarize my conclusion about why PNG format is the best for saving stock chart captures. In addition to the popular JPEG image format, I have often seen other technical analyst bloggers use GIF to post their charts. As such, I'll compare the 3 formats in this article. The criteria for judging image format for stock charts are obviously quality and file size. Quality is definitely what matters the most because stock charting relies heavily on the points and lines for comparison and analysis. If you can't figure out the resistance/support, for example, from looking at the image, then that chart couldn't provide you with in-depth analysis later. Which would render it useless for the purpose of reviewing your trades. As for file size, it depends on if you're posting it online. If that the case, then it's arguably as important as the quality of the image. Waiting for images to load is an unnecessary waste of time. Before digging deeper in this topic. I figured that it's best to just present a real case trading journal example. Here's what I did for the figures attached below. I captured a chart of crude oil futures with my trading screen. Moving averages, channels, volume, and a couple more separate indicators. A pretty typical setup. The first image is saved in JPG format. It is 213 KB in size. Click on it to see the full size image. Notice the compression artifacts. In particular, the distorted colours and pixels. You couldn't really make out some lines because it's blurred. The second image is in PNG format. It is only 68 KB in size, a 1/3 of the JPG. You can see that it's perfectly clear and sharp. If you're interested in more explanation, continue reading. But be forewarned that this could get confusing. According to Wikipedia, .PNG images are generally smaller than GIF but bigger than .JPG. However, PNG images produce sharper quality than JPG if all else remain equal. Thus, for a clear technical analysis chart image capture, PNG's file size is smaller than JPG (and GIF) if the quality and resolution (height and width) are the same. That is because PNG (and GIF) uses a lossless compression technique. Meaning that the compressed image looks exactly the same as the original. Whereas JPG uses a lossy compression technique. Meaning the compressed image is merely close enough with the original. JPG would lose out its advantage of smaller file size because it needs to increase the quality (by reducing compression rate) to keep up with the quality of PNG. And why the quality setting needs to be high for charts? Because of the high contrast and non-uniform nature of stock charts. You can rarely guess what a pixel is like from its neighbours. That is why lossless image compression is highly preferred. Out of the commonly supported trading platform export image formats out there, PNG is the best there is. PNG is also widely supported by web browsers and operating systems, so it's almost impossible that you will find a computer that can't read it. In summary, here's a ranking in terms of file size (for the same resolution and quality of image), #1 being the best:

  1. PNG
  2. GIF
  3. JPG

Then a ranking for the quality at the same resolution and file size, #1 being the best:

  1. PNG
  2. GIF
  3. JPG

(Sorry, I couldn't do a table in this blog) Also note that PNG was designed to be an improvement of GIF. So in most cases, PNG beats GIF. Lastly, there's also BMP bitmap format. Some people may use it because it's the default for Windows Paint and some other software. Although, BMP is lossless too, it has no compression at all. For example, the samples below were 213 KB and 68 KB for JPG and PNG, respectively, but the BMP file is 3,319 KB for exactly the same image! Using BMP is a waste of hard drive space for saving stock charts when you can use PNG for the same image quality. [caption id="" align="aligncenter" width="580" caption="JPG sample (213 KB)"][JPG
sample (213 KB)]JPG sample (213 KB)[/caption] [caption id="" align="aligncenter" width="580" caption="PNG sample (68 KB)"][PNG
sample (68 KB)]PNG sample (68 KB)[/caption]