PHPlot_truecolor — Construct a new PHPlot Truecolor Class Object


$plot = new PHPlot_truecolor([$width], [$height], [$output_file], [$input_file])


This is the constructor for the PHPlot_truecolor class, which is an extended class that inherits from the PHPlot class. Like the PHPlot class, it creates a new plot object and initializes all internal settings to default values, but the resulting image will be a truecolor image, rather than a palette image. (See the notes below regarding an exception to this rule.)



Optional width of the plot image, in pixels. Default is 600.


Optional height of the plot image, in pixels. Default is 400.


Optional name of a file where the image output will be written. This is the same as using SetOutputFile. Default is no output file, meaning the image is written to standard output (that is, sent back to the browser).


Optional name of a file to use as a starting image. This becomes the background for the plot. If an input_file is given, any width and height given to the constructor are ignored, and the size of the image in the named input_file are the plot image size. Default is no input file, meaning a blank image will be created at the given or default width and height.

Return Value

Returns an object, an instance of the PHPlot_truecolor class, which inherits all the functions (methods) of the PHPlot class.


Refer to PHPlot for the base class constructor. Refer to Section 4.3, “Truecolor Images” for more information on truecolor images.

The output_file will be ignored unless SetIsInline(True) is called.

If no input_file is supplied, the PHPlot_truecolor constructor creates a truecolor plot image, and the PHPlot constructor creates a palette plot image. If an input_file is supplied, the two constructors are equivalent, and the type of the input file (truecolor or palette) determines the type of the plot image.

The type of the plot image (truecolor or palette) might not be the same as the type of output file or stream which is generated by PHPlot. For example, a truecolor image is converted to palette if the output format (as set with SetFileFormat) is GIF, which supports only palette images. A palette image is converted to truecolor if the output format is JPEG, which supports only truecolor images. More information can be found in Section 4.3.5, “Image Formats and File Formats, Palette and Truecolor”.


The PHPlot_truecolor class and its constructor were added in PHPlot-5.1.1. For that release only, there was a greater dependency between which constructor was used and which features were available, but this was removed in the next release. Logo

This version of the manual was produced for the PHPlot Sourceforge project web service site, which requires the logo on each page.

To download a logo-free copy of the manual, see the PHPlot project downloads area.