# LuaScript

The path to a Lua script that returns the rotation to apply to the input image, in degrees, clockwise. Specify an absolute path or a path relative to the LuaDirectory.

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.

The following is an example Lua script that you could use to rotate images based on the angle of a face detected in the image, or text detected in the image. In this example, the angles returned are negative, so the rotation is anticlockwise.

    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

Type: | String
Default: |
Required: | Required unless you set Angle
Configuration Section: | TaskName
Example: | `LuaScript=rotate.lua`
See Also: | Angle

© Copyright 2019 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a mail client, and then send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm