web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to take a sub-scre...
Power Automate
Unanswered

How to take a sub-screenshot

(0) ShareShare
ReportReport
Posted on by 7

Maybe you can't understand this subject because I'm not good at English.

I mean: Power Automate can take a screenshot of the whole screen, a window or UI element. But I want to take a screenshot for a rectangle area. The two coordinates represent the upper left and lower right corners of the area. How can I do?

给定左上和右下两点,在两点构成的矩形截图。

I have the same question (0)
  • Lucas_Eduardo Profile Picture
    62 on at

    Isn't it possible (Really don't know why). I've used Python's Pyautogui lib to make a script that does take screenshots based on X and Y because I couldn't figure it out in PAD. (I know that if you want to extract text with OCR you can delimit the area with X and Y.)

  • MrPython Profile Picture
    7 on at

    Do you mean: I should use python or other ways to do that?

    Maybe I can use the Windows screenshot tool(win+shift+s). Do you know how to press the hold mouse and move it?

     

  • Lucas_Eduardo Profile Picture
    62 on at

    I've used Python because for me was the easier way.

    The mouse functions have the option to press mouse button "down" and "up", you can invoke the screenshot tool, press mouse down, move the mouse, and press it up, but I'm not sure if it's going to work...

  • Kaif_Siddique Profile Picture
    2,108 Super User 2024 Season 1 on at

    Hi @MrPython ,

     

    Use PowerSheell Script action to capture the sub screenshot.

    Kaif_Siddique_0-1674158826665.png

     

    Code:

    $File = "Your File Path\screenshot.bmp"
    Add-Type -AssemblyName System.Windows.Forms
    Add-type -AssemblyName System.Drawing

    # Gather Screen resolution information
    $Screen = [System.Windows.Forms.SystemInformation]::VirtualScreen
    $Width = $Screen.Width
    $Height = $Screen.Height
    $Left = $Screen.Left
    $Top = $Screen.Top

    # Set bounds
    $bitmap = New-Object System.Drawing.Bitmap $Width, $Height

    # Create Object
    $graphic = [System.Drawing.Graphics]::FromImage($bitmap)

    # Capture
    $graphic.CopyFromScreen(0, 200, 400, 0, $bitmap.Size) ### ($Left,$Top,$Right,$Bottom) - Change the coordinates as per requirements.

    # Save
    $bitmap.Save($File)

     

    If I have answered your question, please mark my post as Solved.
    If you like my response, please give it a Thumbs Up.


    Regards

    Kaif

  • MrPython Profile Picture
    7 on at

    That's great! But I want to copy the image to the clipboard. How to do that?

  • MrPython Profile Picture
    7 on at

    I can't find the function to press mouse button. Please tell me where is it. You can give me a screenshot. Thank you.

  • Ezhilvannan_V Profile Picture
    178 on at

    Ezhilvannan_V_0-1674823469057.png

    python script:

     

    import os
    import sys
    from PIL import *
    from PIL import ImageEnhance , Image,ImageOps
    import PIL.Image

    def image_1_function(file_path):
    upper_height = 4
    buttom_height = 561
    left_side_width= 465
    right_side_width= 1425
    input_image = Image.open(file_path)
    enhancer_object = ImageEnhance.Sharpness(input_image)
    enhanced_image = enhancer_object.enhance(1.7)
    width_resized, height_resized = enhanced_image.size

    crop_size = (left_side_width, upper_height ,right_side_width, buttom_height)
    cropped = enhanced_image.crop(crop_size)
    cropped.save(os.path.splitext(file_path)[0]+"2"+os.path.splitext(file_path)[1])

    if __name__=="__main__":
    file_path=sys.argv[1]
    image_1_function(file_path)

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 412

#2
Vish WR Profile Picture

Vish WR 305

#3
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

Last 30 days Overall leaderboard