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 [Transform] section, add a new transformation task by setting the TransformEngineN parameter. You can give the task any name, for example:

    [Transform]
    TransformEngine0=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. HPE recommends that you save your configuration files in the location specified by the ConfigDirectory parameter.


_HP_HTML5_bannerTitle.htm