How to crop an image.(Power Automate Desktop)

Japanese version. This section shows how to crop an image file from any position to any size. Steps It can be copied and pasted into Power Automate Desktop. SET SrcFilePath TO $”’C:\\Test\\1.jpg”’ SET SaveFilePath TO $”’C:\\Test\\1_r.png”’ SET X TO 25 SET Y TO 50 SET Width TO 100 SET Height TO 300 Scripting.RunPowershellScript.RunPowershellScript Script: $”’Add-Type -AssemblyName System.Drawing $bmp = New-Object System.Drawing.Bitmap(\”%SrcFilePath%\”) $bmp_r = New-Object System.Drawing.Rectangle(%X%, %Y%, %Width%, %Height%); $result = $bmp.Clone($bmp_r, $bmp.PixelFormat) $result.Save(\”%SaveFilePath%\”, [System.Drawing.Imaging.ImageFormat]::Png) $bmp.Dispose() $result.Dispose()”’ ScriptOutput=> PowershellOutput Set the necessary information for the variable. Variable name Value SrcFilePath Source image file path. SaveFilePath Destination PNG file path. X Crop start position (horizontal). Y Crop start position (vertical). Width Width … Continue reading How to crop an image.(Power Automate Desktop)