There are various ways to create images/graphics with PHP. There are some well known extensions such as ext/GD, or perhaps ext/ming can be remembered, whenever it comes to graphics generation. But there are also some several structural differences not in between the available libraries.
Image :Used it as generalization of pictures and also graphics.
Picture :Images with an natural contents, like as photos or drawings. Usually there are no or only few clear borders in those images.
Graphic :Computer generated graphics with technical illustrations or charts. They contain clear borders.
There are two classes of graphics you generate, and each classes again has several different formats.
We have vector based graphics formats, which means, that format describes shapes, their fills, line styles etc. With those formats its up to some client to actually rendering graphics, as the current normal display expects pixels, the clients needs to transform the shapes into pixels. This may result in differently rendered results, or the quality differences of the output depending on renderer.
SVG stands for "Scalable Vector Graphics". It is open standard, and due its nature being XML, easy to generate, sometimes even user readable. XML always has the drawback of quite large files, compared with an contained information. But, as vector graphics formats do not need to describe each pixel, but the shapes which may be bigger, and you may compress XML using gzip. Common SVG(Scalable Vector Graphics) graphics are mostly smaller than the similar images which use bitmap format.
There are two drawbacks when it comes to SVG rendering in image viewers. The subset supported SVG elements may differ. The W3C defines standard called as SVG Tiny which contains small subset which common to nearly all the clients.
The issue with those different clients is the rendering of text. You just can't know which fonts may be available on client, and because of this you cannot know how much space some text will consume, or how it will look like. To bypass the issue you may convert text into paths, which is been supported by some of the editors.
On other hand there are bitmap formats, like as PNG, GIF, JPEG or BMP. Using these formats the quality and overall result complete depends on image generation tool.
GIF format had patent issues for some time, which made it unavailable on some tools. Even format is now available everywhere it has several limitations, like limited colorspace – maximum: 256 colors - and bad support for the transparency - you can define only one color as fully transparent, makes alpha blending impossible.
It is also a very widely supported format, but compression algorithm makes it useless for graphics, but it is more appropriate for the common pictures. Algorithm performs a fourier transformation. With the lower quality factor for JPEG images, amount of cosine terms in resulting function will get reduced, which makes it as harder and harder to describe sharp edges. Another drawback of JPEG format is, it does not have any support for the transparency
PNG has been developed and standardized by the W3C because of the GIF issues and it is ultimate format for the graphics, especially on web. It has lossless compression, supports full RGB colorspace, 128 alpha channels for each color and results in quite small files, when quality is compared with GIF or JPEG graphics of same size. Currently, only drawback is, that the outdated browser Internet Explorer 6 still does not support alpha channels in PNG.
BMP, TIF, ...
There are far more bitmap formats, which does not do compression or support other colorspaces like as CMYK/HSL. They do not matter for web related images, because they normally result in far too big files, to use them in the web.