Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 82QRGd5DA7jRw4SAjdX1iu
Power Automate - Power Automate Desktop
Answered

Rotate Images

Like (0) ShareShare
ReportReport
Posted on 17 Aug 2022 10:35:57 by 570

Does anyone have any idea how to rotate images in a folder using a PowerShell script? I'm working on an OCR flow that converts PDFs to images to OCR scan for data to be used in the renaming and moving of the PDFs. The OCR does not seem to work on images rotated 90 degrees. Think of a landscape page scanned as a portrait. So any remaining images after my flow will need to be rotated. I can achieve this through UI manipulation, but I was hoping for a more efficient way.

  • Suggested answer
    takolota1 Profile Picture
    4,859 Super User 2025 Season 1 on 27 Mar 2025 at 02:00:15
    Rotate Images
    If you use the AI Builder OCR Recognize text in an image or pdf then there are ways to manipulate that data so it always reads the text as up-right.
     
    I show an example of how to do this in this extract data from pdfs template: https://community.powerplatform.com/galleries/gallery-posts/?postid=31e67eea-3f73-47b4-95b7-fe4a7b646389
  • Verified answer
    Kaif_Siddique Profile Picture
    2,104 Super User 2024 Season 1 on 17 Aug 2022 at 19:29:18
    Re: Rotate Images

    Hi Jason,

     

    Please refer the below PowerShell script to rotate multiple images in a specific folder:

    --------------------------------------------------------------------------------

    $path = "FOLDER PATH" #target directory

    [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
    Get-ChildItem -recurse ($path) -include @("*.png", "*.jpg") |
    ForEach-Object {
    $image = [System.Drawing.image]::FromFile( $_ )
    $image.rotateflip("Rotate90FlipNone")
    $image.save($_)
    }

    --------------------------------------------------------------------------------

     

    Hope this will help.

     

    Regards

    Kaif

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,695 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard
Loading started