obsproject / obs-websocket

Remote-control of OBS Studio through WebSocket
GNU General Public License v2.0
3.8k stars 701 forks source link

Feature Request: Make screenshots respect their source cropped size #1132

Closed MrPowerGamerBR closed 1 month ago

MrPowerGamerBR commented 1 year ago

Feature Request Type

RPC Request

Feature Request Type (Other)

No response

Requested Feature

Currently if you attempt to screenshot a source that has been cropped with an filter, the screenshot will have transparent pixels where the source has been cropped. This is bad since you end up sending/saving a lot of unnecessary pixels when attempting to take a screenshot of these sources.

There's an workaround: If you create a screenshot of a Source Clone that is cloning a cropped source, the screenshot will have the correct width/height.

Here's an example: I'm cropping (0, 0) 512x512 on the source, notice how the image itself is actually 2560x1440, even tho it was cropped.

current_valorant_frame

If I create a Source Clone that clones the cropped source above, the image is cropped and respects the cropped image size of 512x512. current_valorant_frame

However doing this workaround is extremely cumbersome, since you end up having to create two sources: One for the crop, then another that clones the cropped source.

image

However I do understand that sometimes you may want the original raw source image, even if it was resized/cropped in OBS, so maybe an additional field respectCrops could be added? We could even go further beyond and add a proper cropX/cropY/cropWidth/cropHeight to the screenshot requests, this way you wouldn't need to create additional Source Clones to setup the necessary crops, and with this you could even somewhat reimplement this plugin that doesn't work anymore with only OBS websockets + smol bmp image requests.

Requested Feature Usage Scenario

I'm using the screenshot feature to check pixels on one of my sources, to trigger things on my scene. Example: When using a power up in game (in my case: trigger Yoru's mask on my PNGTuber when I use Yoru's ultimate in VALORANT), trigger effects on the scene. When the match starts, move stuff around on the screen to have better visibility of the game/game info, so on and so forth.

This could be done with this plugin but sadly, it is broken in OBS 29.

tt2468 commented 1 month ago

Fixed in https://github.com/obsproject/obs-websocket/commit/5c3c4c76c8d8b4d00d45face465e05b04ff7ddf5