Media Server 25.1
Media Server Help

# Rotate Images

To configure Media Server to rotate images, follow these steps.

To rotate images

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
       ...
       Engine3=Rotation

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 `Rotate`.
   `Input` | The name of the image track to process.
   `Angle` | (Set this or `LuaScript`) The rotation to apply to the input image, in degrees, clockwise.
   `LuaScript` | (Set this or `Angle`) The path to a Lua script that returns the rotation to apply to the input image, in degrees, clockwise. The Lua script must define a function named `getAngle`, which must return the angle. Media Server can rotate images in 90-degree increments, so all other angles are rounded.

   For example:

       [Rotation]
       Type=Rotate
       Input=FaceDetect.ResultWithSource
       LuaScript=Rotate.Lua

   A suitable Lua script is included below:

       function getAngle(record)
         if (record.OCRResultAndImage) then
            return -record.OCRResultAndImage.angle
         elseif (record.FaceResultAndImage) then
            return -record.FaceResultAndImage.face.ellipse.angle
         elseif (record.FaceRecognitionResultAndImage) then
            return -record.FaceRecognitionResultAndImage.face.ellipse.angle
         elseif (record.DemographicsResultAndImage) then
            return -record.DemographicsResultAndImage.face.ellipse.angle
         elseif (record.FaceStateResultAndImage) then
            return -record.FaceStateResultAndImage.face.ellipse.angle
         end

         return 0
       end

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

Copyright 2024 Open Text
Version 25.1 | Last updated January 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery Media Server 25.1

Topic Title: Rotate Images