Graphics Server Technologies: Graphs and Charts for the World
 

About Us
Press
Column Articles
Newsletter
Contact
Privacy
Site Map

Home / Column Articles/ August 2002 Column Article

August 2002 Column Article

Graphics Server JPEG Compression

By Matt Berry

It's well known that Graphics Server adds graphing capability to Windows applications and Web sites and that Graphics Server serves up stunning graphs and charts in a variety of formats - but what about managing those images? As a developer creates images for stand-alone applications or for Web sites, file size issues must be taken into consideration along with the other needs of the customer(s), the application and/or the Web site's functionality.

Image file size issues are most notable on the Web, where download time is still an issue for the majority of Internet users. As broadband or high speed Internet connections become more readily available, the issues involving file size will eventually lessen in time, but it is still a good idea to keep file sizes small whenever possible. It's common knowledge that people don't have patience for Web pages that load slowly and this is true even for broadband users. The quicker a Web site's pages load and users are able to access a Web site's information the happier they'll be.

As with the Internet, stand-alone applications also benefit from smaller file sizes, even if the load time is not quite as noticeable as on a Web page. It takes time to load image files in stand-alone applications, so the smaller the file size the faster the image will display on screen. Problems with images loading quickly will be more noticeable on older, slower machines, which may or might not describe the machines of a particular customer base but it's best to accommodate all possibilities and all users. This would not affect applications using ActiveX controls placed directly into the application, because in these instances it's the controls that are loaded, not the image files.

Whether you're using Graphics Server images in stand-alone applications or on a Web site, the new JPEG compression feature available in version 6.0 allows you to reduce the file size of graph images. There is a trade-off between file size reduction and compression as there is a visible loss in quality as the file size is reduced. Depending on the data and intended use of images in an application or Web site, the loss in quality may be less important than the overall ease of use of the application or Web site. With the JPEG compression feature there is always the option to tweak the compression value, so the perfect trade off between image quality and reduced image size can be achieved.

JPEG compression values for Graphics Server version 6 range from 0 (no compression) to 255 (highest compression), and include any integer value in between. The following graphs illustrate different levels of compression, this example achieves an 80% reduction in file size when the highest compression setting is used.


Graph1 - JPEG Compression Setting = 0, File Size = 26541 Bytes


Graph 2 - JPEG Compression Setting = 85, File Size = 7961 Bytes


Graph 3 - JPEG Compression Setting = 170, File Size = 5998 Bytes


Graph 4 - JPEG Compression Setting = 255, File Size = 5083 Bytes

As demonstrated in the sample graphs, compression and size reduction are not one to one. As the compression settings increase, the file size continues to be reduced but not at the same rate as the compression settings. For example, Graph 2 has a compression setting of 85 units, this setting reduces the image size by 25%. In Graph 3 the compression goes up by another 85 units but the image is not reduced by an additional 25%, instead, it's reduced by only 15%. It depends on how important the information in your image is. In some cases reducing image size by 80% will not jeopardize the integrity of your data. In other instances it may be necessary to forgo smaller file size for clarity or detail. In the example above, all four images are still legible, and if legibility is all that is needed then a JPEG compression setting of 255 can be used.

Versions of Graphics Server prior to 6.0 supported JPEG images, but did not allow for a JPEG compression setting. The default for older versions is a JPEG compression setting of 90, which is similar to the image quality and image size in Graph 2 above.

Graphics Server version 6.0 also has an expanded list of image file types you can save to. Included in the expanded formats is FlashPix, an image file type that also supports image file compression. The FlashPix format is not as widely used as JPEG, but a similar file size/image quality ratio will be achieved when using FlashPix compression.

Another new feature in version 6 of Graphics Server is the option to use gradient bar colors. This is illustrated in the example graphs above where the colors start at white on the bottom and fade into the specified bar color (white to red in "Jan", white to orange in "Feb", etc.).

With the added image capabilities in Graphics Server 6.0 you'll find countless ways to improve presentation and manage graphs. The latest image compression option will no doubt be another invaluable tool to developers.

    About Us      Contact      Privacy      Sitemap