Repository: electron
Issue: [Feature Request]: Add ability to specify returned image dimensions when calling `webContents.capturePage()`
Labels: enhancement :sparkles:

### Preflight Checklist

- [X] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a feature request that matches the one I want to file, without success.

### Problem Description

I actively use `contents.capturePage([rect, opts])` API to generate page thumbnails. I noticed, that a number of users with low-end devices wait for significant amount of time to get the thumbnail generated.
If we had an API to specify returned dimensions of returned image it would improve the speed and (I guess) RAM usage when generating thumbnails.

### Proposed Solution

Currently, `opts` is an object with two parameters:

```
  * `stayHidden` boolean (optional) -  Keep the page hidden instead of visible. Default is `false`.
  * `stayAwake` boolean (optional) -  Keep the system awake instead of allowing it to sleep. Default is `false`.
```

I propose add third parameter `outputSize` which will be used to specify `width` and `height` of the returned image.

I drafted [a PR](https://github.com/electron/electron/pull/41281) and I run the comparison on my Apple M1 MacBook Pro with the following fiddle:

https://gist.github.com/Imperat/d90f3754cea8c896bdc6e99db5a12c90 and Electron compiled from branch `27-x-y`.

The result is below: (`true` - for `capturePage` calls with using of `outputSize` and `false` for not using it.
<details>

```
diff light[true] is: p2 - p1 170.7020410001278
diff light[false] is: p2 - p1 13.709124997258186
diff light[true] is: p2 - p1 27.320374995470047
diff light[false] is: p2 - p1 22.66704200208187
diff light[true] is: p2 - p1 21.654917001724243
diff light[false] is: p2 - p1 21.019082993268967
diff light[true] is: p2 - p1 22.3123330026865
diff light[false] is: p2 - p1 22.04754100739956
diff light[true] is: p2 - p1 20.369040995836258
diff light[false] is: p2 - p1 20.239083006978035
diff light[true] is: p2 - p1 19.256334006786346
diff light[false] is: p2 - p1 22.024167001247406
diff light[true] is: p2 - p1 22.489707991480827
diff light[false] is: p2 - p1 10.71612499654293
diff light[true] is: p2 - p1 16.85216599702835
diff light[false] is: p2 - p1 76.42458300292492
diff light[true] is: p2 - p1 52.98329100012779
diff light[false] is: p2 - p1 67.16875000298023
diff light[true] is: p2 - p1 56.71966700255871
diff light[false] is: p2 - p1 75.69170799851418
diff light[true] is: p2 - p1 50.05275000631809
diff light[false] is: p2 - p1 60.259124994277954
diff light[true] is: p2 - p1 53.10708300769329
diff light[false] is: p2 - p1 90.18691599369049
diff light[true] is: p2 - p1 61.33612498641014
diff light[false] is: p2 - p1 56.14208300411701
diff light[true] is: p2 - p1 65.65341700613499
diff light[false] is: p2 - p1 86.26179099082947
diff light[true] is: p2 - p1 59.91508300602436
diff light[false] is: p2 - p1 65.22491699457169
diff light[true] is: p2 - p1 49.36979199945927
diff light[false] is: p2 - p1 73.71187500655651
diff light[true] is: p2 - p1 54.444333001971245
diff light[false] is: p2 - p1 60.43724998831749
diff light[true] is: p2 - p1 53.02783299982548
diff light[false] is: p2 - p1 83.88495799899101
diff light[true] is: p2 - p1 54.18916700780392
diff light[false] is: p2 - p1 57.52920900285244
diff light[true] is: p2 - p1 53.54975000023842
diff light[false] is: p2 - p1 61.92333400249481
diff light[true] is: p2 - p1 54.725915998220444
diff light[false] is: p2 - p1 85.34937500953674
diff light[true] is: p2 - p1 53.67079100012779
diff light[false] is: p2 - p1 57.28716699779034
diff light[true] is: p2 - p1 60.01741699874401
diff light[false] is: p2 - p1 91.5783330053091
diff light[true] is: p2 - p1 54.120959013700485
diff light[false] is: p2 - p1 49.25466699898243
diff light[true] is: p2 - p1 51.74362500011921
diff light[false] is: p2 - p1 69.6712090075016
diff light[true] is: p2 - p1 55.844208002090454
diff light[false] is: p2 - p1 62.27633400261402
diff light[true] is: p2 - p1 50.40879198908806
diff light[false] is: p2 - p1 82.5701249986887
diff light[true] is: p2 - p1 51.1407919973135
diff light[false] is: p2 - p1 59.52491699159145
diff light[true] is: p2 - p1 55.36787500977516
diff light[false] is: p2 - p1 84.55770900845528
diff light[true] is: p2 - p1 55.20454199612141
diff light[false] is: p2 - p1 78.4293330013752
```

</details>

I am happy to test with slower devices to prove the need of this feature if necessary 🙏 

### Alternatives Considered

N/A

### Additional Information

_No response_