# Draw Regions

The `Draw` transformation task draws regions on images or video frames.

To draw regions on images and video frames

1. Create a new configuration to send to Media Server with the `process` action, or open an existing configuration that you want to modify.

2. In the `[Session]` section, add a new task by setting the `EngineN` parameter. You can give the task any name, for example:

       [Session]
       Engine0=Ingest
       ...
       Engine2=Draw

3. Create a new configuration section to contain the task settings and set the following parameters:

   `Type` | The transformation engine to use. Set this parameter to `Draw`.
   `Input` | The name of the track that contains the images to draw on, with region data. The track must supply records that contain both an image and at least one region.
   `Color` | (Optional) The line color to use when drawing.
   `Thickness` | (Optional) The line thickness to use when drawing. Specify the thickness in pixels.

   For example:

       [Draw]
       Type=Draw
       Input=CombineESP.Output
       Color=Red
       Thickness=1

4. Save and close the configuration file. Micro Focus recommends that you save your configuration files in the location specified by the `ConfigDirectory` parameter.

Example configuration to ingest video and draw regions on encoded images

The following example configuration ingests a video file or stream and encodes one image for each detected face. Each image will show a red ellipse around the detected face.

    [Session]
    Engine0=Ingest
    Engine1=FaceDetect
    Engine2=Draw
    Engine3=Images

    [Ingest]
    Type=Video

    [FaceDetect]
    Type=FaceDetect
    NumParallel=6
    MinSize=10%

    [Draw]
    Type=Draw
    Input=FaceDetect.ResultWithSource
    Color=Red
    Thickness=2

    [Images]
    Type=ImageEncoder
    ImageInput=Draw.Output
    OutputPath=./output/%session.token%/%record.starttime.iso8601%.png

Example configuration to ingest video and draw regions on encoded video

The following example configuration ingests a video file or stream and encodes a video that shows detected faces by surrounding them with a red ellipse.

In this example, an ESP task combines the `Image_1` track and the `FaceDetect.Data` track. This is necessary because the tracks produced by face detection only contain frames with detected faces, but to encode the video correctly we need to encode every frame.

    [Session]
    Engine0=Ingest
    Engine1=FaceDetect
    Engine2=Combine
    Engine3=Draw
    Engine4=MPEG

    [Ingest]
    Type=Video

    [FaceDetect]
    Type=FaceDetect
    NumParallel=6
    MinSize=10%

    [Combine]
    Type=Combine
    Input0=Image_1
    Input1=FaceDetect.Data
    MaxTimeInterval=50ms

    [Draw]
    Type=Draw
    Input=Combine.Output
    Color=Red
    Thickness=2

    [MPEG]
    Type=mpeg
    VideoProfile=mpeg4video_h264_720p
    ImageInput=Draw.Output
    OutputPath=./output/%session.token%/%segment.startTime.iso8601%.ts

_FT_HTML5_bannerTitle.htm