for Microsoft Power Automate and Azure logic apps

By Jay Goodison

28th March 2022

Get Image File Information using Power Automate

Our ‘Get PDF Document Information‘ action has been available for a while. The action exposes information about a PDF file within Power Automate, enabling automation logic to be executed considering information about the PDF document provided, for example validating whether a file contains a text layer before performing OCR.

Today we’re really pleased to introduce our new ‘Get Image Information‘ action which exposes information about the image file provided covering: image format, size, width, height, orientation, EXIF Data and much more.

At the time of writing this new action is now available on Encodian’s (Azure PaaS hosted) global cloud platform, and Microsoft are updating Power Automate to make this new action available to all regions; this is due to complete sometime April 22

For this post let’s explore a few example scenarios for using the new ‘Get Image Information‘ action:

Conditional Image Resize with Power Automate

For this scenario the flow we are going to create will validate the dimensions of an image to determine whether the image should be resized. I have created a very simple flow which is triggered when a new file is added to a SharePoint library; you may wish to add trigger conditions to ensure the flow is only triggered for files with a certain extension (images), check out: Create Power Automate Trigger Conditions Simplified

The ‘Get Image Information‘ action returns the following properties about the image provided:

  • Image Format – The file format of the image
  • File Size (MBs) – The size of the supplied image in MBs
  • Width – The width of the image (Pixels)
  • Height – The height of the image (Pixels)
  • Orientation – The orientation of the image
  • Bits per Pixel – The image bits per pixel count
  • Horizontal Resolution – The horizontal image resolution (DPI)
  • Vertical Resolution – The vertical image resolution (DPI)
  • Has EXIF Data – Confirms whether the image contains EXIF Data
  • EXIF Data (JSON) – Image EXIF Data provided as a JSON string
  • Has XMP Data – Confirms whether the image contains XMP Data

Consider the following updates to the flow which uses a condition to validate the width of the image, and then if required, resizes the image using the ‘Resize an Image‘ action before updating the original file with the resized image:

This of course is a simple example and any conditional logic can be performed on the data returned by the ‘Get Image Information‘ action.

Remove Image EXIF Data with Power Automate

In addition to releasing the new ‘Get Image Information‘ action, we’re also really pleased to introduce our new ‘Remove EXIF Tags from Image‘ action which will remove EXIF tags from the image provided.

I have created a very simple flow which is triggered when a new file is added to a SharePoint library; you may wish to add trigger conditions to ensure the flow is only triggered for files with a certain extension (images), check out: Create Power Automate Trigger Conditions Simplified

Consider the following updates to the flow which uses a condition to evaluate the ‘Has EXIF Data‘ property returned by the ‘Get Image Information‘ action, and then if required, removes the images EXIF data using the new ‘Remove EXIF Tags from Image‘ action prior to updating the original file.

Reading Image EXIF Tags in Power Automate

Building upon the previous scenario where Image EXIF tags were removed using the new ‘Remove EXIF Tags from Image‘ action, the ‘Get Image Information‘ action returns EXIF image tags as a JSON string which can be parsed allowing access to all the contained data:

The ‘EXIF Data (JSON)’ properties value can be parsed using Power Automate’s ‘Parse JSON‘ action, for example:

You can create the schema using the ‘Generate from sample‘ function or by using the schema below:

{
    "type": "object",
    "properties": {
        "apertureValue": {
            "type": "number"
        },
        "artist": {             
            "type": "string"         
         },
        "bodySerialNumber": {             
            "type": "string"         
        },
        "brightnessValue": {
            "type": "number"
        },
        "cameraOwnerName": {             
            "type": "string"         
        },
        "colorSpace": {
            "type": "string"
        },
        "compressedBitsPerPixel": {
            "type": "integer"
        },
        "compression": {
            "type": "integer"
        },
        "contrast": {
            "type": "string"
        },
        "customRendered": {
            "type": "string"
        },
        "dateTime": {
            "type": "string"
        },
        "dateTimeDigitized": {
            "type": "string"
        },
        "dateTimeOriginal": {
            "type": "string"
        },
        "digitalZoomRatio": {
            "type": "integer"
        },
        "exposureBiasValue": {
            "type": "integer"
        },
        "exposureIndex": {
            "type": "integer"
        },
        "exposureMode": {
            "type": "string"
        },
        "exposureProgram": {
            "type": "string"
        },
        "exposureTime": {
            "type": "number"
        },
        "fileSource": {
            "type": "string"
        },
        "flash": {
            "type": "string"
        },
        "flashEnergy": {
            "type": "integer"
        },
        "fNumber": {
            "type": "number"
        },
        "focalLength": {
            "type": "number"
        },
        "focalLengthIn35MmFilm": {
            "type": "integer"
        },
        "focalPlaneXResolution": {
            "type": "integer"
        },
        "focalPlaneYResolution": {
            "type": "integer"
        },
        "gainControl": {
            "type": "string"
        },
        "gamma": {
            "type": "integer"
        },
        "gpsAltitude": {
            "type": "number"
        },
        "gpsAltitudeRef": {
            "type": "string"
        },
        "gpsDateStamp": {
            "type": "string"
        },
        "gpsDestBearing": {
            "type": "number"
        },
        "gpsDestBearingRef": {
            "type": "string"
        },
        "gpsDestDistance": {
            "type": "integer"
        },
        "gpsDestDistanceRef": {             
            "type": "string"         
        },
        "gpsDestLatitudeRef": {             
            "type": "string"         
        },
        "gpsDestLongitudeRef": {             
            "type": "string"         
        },
        "gpsDifferential": {
            "type": "integer"
        },
        "gpsDop": {
            "type": "integer"
        },
        "gpsImgDirection": {
            "type": "number"
        },
        "gpsImgDirectionRef": {
            "type": "string"
        },
        "gpsLatitudeRef": {
            "type": "string"
        },
        "gpsLongitudeRef": {
            "type": "string"
        },
        "gpsMapDatum": {},
        "gpsMeasureMode": {},
        "gpsSatellites": {},
        "gpsSpeed": {
            "type": "integer"
        },
        "gpsSpeedRef": {
            "type": "string"
        },
        "gpsStatus": {             
            "type": "string"         
        },
        "gpsTrack": {             
            "type": "string"         
        },
        "gpsTrackRef": {             
            "type": "string"         
        },
        "imageUniqueId": {             
            "type": "string"         
        },
        "isBigEndian": {
            "type": "boolean"
        },
        "isoSpeed": {
            "type": "integer"
        },
        "isoSpeedLatitudeYyy": {
            "type": "integer"
        },
        "isoSpeedLatitudeZzz": {
            "type": "integer"
        },
        "lensMake": {
            "type": "string"
        },
        "lensModel": {
            "type": "string"
        },
        "lensSerialNumber": {             
             "type": "string"         
        },
        "lightSource": {
            "type": "string"
        },
        "make": {
            "type": "string"
        },
        "maxApertureValue": {
            "type": "integer"
        },
        "meteringMode": {
            "type": "string"
        },
        "model": {
            "type": "string"
        },
        "orientation": {
            "type": "string"
        },
        "photographicSensitivity": {
            "type": "integer"
        },
        "pixelXDimension": {
            "type": "integer"
        },
        "pixelYDimension": {
            "type": "integer"
        },
        "recommendedExposureIndex": {
            "type": "integer"
        },
        "relatedSoundFile": {},
        "saturation": {
            "type": "string"
        },
        "sceneCaptureType": {
            "type": "string"
        },
        "sensingMethod": {
            "type": "string"
        },
        "sensitivityType": {
            "type": "integer"
        },
        "sharpness": {
            "type": "integer"
        },
        "shutterSpeedValue": {
            "type": "number"
        },
        "spectralSensitivity": {             
            "type": "string"         
        },
        "standardOutputSensitivity": {
            "type": "integer"
        },
        "subjectDistance": {
            "type": "integer"
        },
        "subjectDistanceRange": {
            "type": "string"
        },
        "subsecTime": {             
            "type": "string"         
        },
        "subsecTimeDigitized": {
            "type": "string"
        },
        "subsecTimeOriginal": {
            "type": "string"
        },
        "userComment": {             
            "type": "string"         
        },
        "whiteBalance": {
            "type": "string"
        }
    }
}

The image’s EXIF data can then be used within your flow:

Final thoughts…

Hopefully, this post demonstrates how the new ‘Get Image Information‘ action can be used to obtain image information and perform conditional logic within Power Automate flows.

We hope you’ve found this guide useful, as ever please share any feedback or comments, all welcome!

Leave a comment

Your email address will not be published.