Skip to content
Karl R. Wilcox edited this page Oct 11, 2018 · 22 revisions

The Shield Drawing function of DrawShield can be invoked in 3 ways:

  1. From the command line (no options are processed and the output is fixed as PNG). This mode is largely for debugging but might also be useful for bulk generation of PNG images.

  2. Via an HTTP POST request - this is the recommended method as it gives the greatest flexibility and range of options (described below). This the method used by the drawshield.net website "create" page.

  3. Via an HTTP GET request - this is also useful and quite flexible, the only option not available is that it is not possible to provide the blazon in an uploaded file.

DrawShield from the command line

This is a very simple process, all of the arguments will be concatenated into a single string, separated by spaces and this will be treated as the blazon. A file named shield.png will be created which will be 500 pixels wide, using the DrawShield colour scheme, the heater shield shape and the shiny effect.

The program should be run from the top level directory containing the drawshield code. An example command line would be:

php drawshield.php azure a bend or

Options for GET and POST

If the drawshield code is installed on a PHP enabled web-server it can be invoked either by a GET or a POST request. An equivalent GET request to the example above would be:

http://drawshield.net/include/drawshield.php?blazon=azure%20a%20bend%20or

If you install the drawshield code on your own server then obviously the URL and the initial path may be different.

Except where noted below, the GET and POST methods to drawshield accept the same set of arguments. All argument names and values must be lowercase, except for the blazon, which may in mixed case and contain accented characters.

blazon

This is the only mandatory argument, although it can be blank, in which case an empty shield is constructed and returned. The value must be entity encoded.

As noted above, mixed case and accented characters are supported (although this is not necessary, for parsing purposes the program will lowercase all input and "collapse" accented characters to their unaccented versions). Case and accents are preserved in strings, for example vert the word "Olé" argent will display as shown.

blazonfile

This argument is only available with the POST method. If a form includes multi-part data with the name "blazonfile", a filename that ends in ".txt" and is less than 100,000 characters long then the contents of that multi-part data will be used as the input blazon. Note that the existence of blazonfile will take precedence over a blazon given in the "blazon" argument.

outputformat

This argument determines the output format of the drawn shield, allowable values are:

  • svg - SVG vector graphic format, XML data rendered as an image by your browser (default)
  • jpg - JPEG image
  • png - PNG image with a transparent background

(Note that if the argument "asfile" is present then this argument is ignored - the argument "saveformat" is used instead)

size

This argument is slightly mis-named in that it is actually the width of the resulting image. It will be coerced to be at least 100 but has no upper limit. The default value is 500. It represents the width in pixels of the rendered image. The height of the image will usually be 1.2 times the width but some shapes have slightly different values.

shape

This option sets the outline shape of the shield, allowable values are:

Value Shape
heater (default) Example Shape
french Example Shape
oval Example Shape
lozenge Example Shape
square Example Shape
italian Example Shape
swiss Example Shape
english Example Shape
german Example Shape
polish Example Shape
spanish Example Shape

palette

This option sets the choice of colours to be used in displaying the shield. (There is no defined meaning of heraldic colours other than, for example, "gules" is to be represented as something resembling "red"). Various authorities have developed their own colour choices and drawshield supports the following option values:

Value Example Palette
drawshield (default) Example Palette
wikipedia Example Palette
emoji Example Palette
wappenwiki Example Palette
bajuvarian (N/A)

You can define your own colour palette, following the instructions on

Clone this wiki locally