-1

I am using a PowerShell command to screengrab a window by using a bat file as follows:

powershell -c "Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SendKeys]::SendWait('%%{PRTSC}')"

However, the resulting image is washed out as if the Gamma setting is not taken in to account. See images (Left side) is what the snipping tool does (Right side) is what the code does.

Does anyone know if there is a setting within PrintScreen that corrects for the washed-out-ness? (which I think is probably to do with the lack of Gamma Setting control.)

Image captured using the Snipping tool(Left) and image captured using the PowerShell code (Right)

Filburt
  • 17,626
  • 12
  • 64
  • 115
  • SO has rules: [Provide MRE](https://stackoverflow.com/help/minimal-reproducible-example) --- [How to ask](https://stackoverflow.com/help/how-to-ask) --- [Don't ask](https://stackoverflow.com/help/dont-ask) --- [Proper Topic](https://stackoverflow.com/help/on-topic) --- [Why not upload images of code/errors?](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question) --- [format your post properly](https://stackoverflow.com/help/formatting) – postanote Apr 16 '21 at 09:17
  • This is not a PowerShell issue or question. It is an OS operational environment one. Firstly, that command you are using is not valid and will error off with. `Exception calling "SendWait" with "1" argument(s): "SendKeys string '%%{PRTSC}' is not valid." At line:1 char:46`. It's a single `%` operator. – postanote Apr 16 '21 at 09:18
  • As for comparing the two, it's not really an apples-to-apples thing. The ST is specifically a design graphic tool, PRTSCR is not. [You'll see the same washout if you use say, the built-in Windows PSR (problem step recorder) tool](https://support.microsoft.com/en-us/windows/record-steps-to-reproduce-a-problem-46582a9b-620f-2e36-00c9-04e25d784e47). – postanote Apr 16 '21 at 09:18
  • There is no controlling PRTSCR that I am aware of. [You'd have to write your own tool or use a preexisting one.](https://duckduckgo.com/?q=%27powershell+script+to+capture+screen%27&t=h_&ia=web&iai=r1-0&page=1&sexp=%7B%22cdrexp%22%3A%22b%22%2C%22biaexp%22%3A%22b%22%2C%22msvrtexp%22%3A%22b%22%2C%22videxp%22%3A%22a%22%7D) – postanote Apr 16 '21 at 09:22
  • Thanks @postanote. (yes I am a newbie to SO and will look at the tutorials you posted). I will look at the system gamma settings. My I was told the double percent "%%" is print current window only rather than the whole Desktop – Graham3D Apr 18 '21 at 10:43
  • No worries, and welcome SO. – postanote Apr 18 '21 at 11:16

1 Answers1

0

Extending from my comment ---

Again, no reason to write from scratch, unless it's a learning thing or guess at it. Use what is already available.

Find-Module -Name '*screen*'
# Results
<#
Version      Name                              Repository Description             
-------      ----                              ---------- -----------             
1.0.2        windows-screenfetch               PSGallery  Powershell port of the Bash Screenshot Information Tool                              
1.2          ChangeScreenResolution            PSGallery  This module give tools to change screen resolution from PowerShell console on Windows
...              
1.0          PSScreenshot                      PSGallery  Save a screenshot from PowerShell.
...               
1.0.8        psScreenRecorder                  PSGallery  Desktop Video Capture with PowerShell
...                     
#>

Find-Script -Name '*screen*'
# Results
<#
Version Name                                      Repository Description                                                 
------- ----                                      ---------- -----------                                                 
1.0.0.2 Save-ScreenCapture                        PSGallery  Capture and save one or more screens to a file as a .JPG....
...
#>
postanote
  • 15,138
  • 2
  • 14
  • 25