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 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, we have made this new action available on Encodian’s (Azure PaaS hosted) global cloud platform. Microsoft is updating Power Automate to make this action available to all regions; due in 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 example flow validates an image’s dimensions and determines whether the image should be resized. You trigger this simple flow by adding a new file to a SharePoint library. You may wish to add trigger conditions to ensure the flow is only triggered for files with a specific 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 includes XMP Data
Consider the following updates to the flow, which uses a condition to validate the width of the image, and then if required, resize 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 This Flow can perform any conditional logic 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 pleased to introduce our new ‘Remove EXIF Tags from Image’ action, which will remove EXIF tags from the image provided.
Below is a very simple flow which you trigger when adding a new file to a SharePoint library. You may wish to add trigger conditions to ensure the flow only works for files with a particular 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 before updating the original file.
Reading Image EXIF Tags in Power Automate
Building upon the previous scenario where Image EXIF tags were removed, the ‘Get Image Information’ action returns EXIF image tags as a JSON string which can be parsed, allowing access to all the contained data:
You can parse the ‘EXIF Data (JSON)’ properties value 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" }, "gpsLatitude": { "type": "string" }, "gpsLatitudeRef": { "type": "string" }, "gpsLongitude": { "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" } } }
Power Automate can then use the image’s EXIF data 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!