How to draw a picture (graph) with minimum size using PHP GD library

Posted on 2005-03-08
Medium Priority
Last Modified: 2012-05-05
Dear all

I am using 3rd parties library, ChartDirector, http://www.advsofteng.com/ to draw my share market graph statistics (using PHP and mysql as DB)

I need to draw an 10 hours graph (picture) with 5 sec interval, but the picture size is simple too big, > 20M and still growing

I am targeting for ~ 1M picture size with as many data as above

Appreciate your comment!

Question by:garytan
LVL 49

Expert Comment

ID: 13484199
What happens when you use image_jpeg for output with a high compression?

Or isn't that an option due to needed quality?

Author Comment

ID: 13484566
ya, quality required too
LVL 25

Accepted Solution

Marcus Bointon earned 500 total points
ID: 13487325
It just sounds like you're just drawing too big a graph - a 20Mb image is going to be about 3000 pixels wide! The quantity of data you're drawing should have little to do with the size of the output graph (unless image resolution is limiting the data you're drawing), so I really don't see why it should be a problem. Typically graphs use lots of flat colours, so JPEG is probably not a good compression scheme to use - PNG should give much cleaner results.

Alternatively, just use different graph drawing software such as:


I use jpgraph all the time and my graphs rarely exceed 30k, no matter how many points I'm drawing.

Assisted Solution

a2liter earned 500 total points
ID: 13488489
I have been using this application for years and it is very flexable and easy to use. it can create just about anykind of graph or chart you want on the fly. I mostly use it with data stored ina mysql DB to generate graphs from datasets chosen by users via web interface. It costs a little, but I think it is well worth the investment if you are doing a lot of graphical analysis of data and need to do it on the fly.


LVL 11

Expert Comment

ID: 15639996
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
Split between Squinky and a2liter

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

- Neester -
EE Cleanup Volunteer

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question