synap5e / obs-screenshot-plugin

An OBS Studio filter plugin to save screenshots of a source/scene
GNU General Public License v2.0
136 stars 20 forks source link

Output images may have incorrect size #6

Closed mili-inch closed 4 years ago

mili-inch commented 4 years ago

The output images will have a transparent area to its right side if the filter is added to a source with an unusual size like 500x500. Tested environment: obs-studio 24.0.3 64bit file mode media source (webm) 500x500 output size: 512x500

synap5e commented 4 years ago

This is almost certainly caused by using linesize / 4 instead of width when writing the data https://github.com/synap5e/obs-screenshot-plugin/blob/9bd40519a4e17763b739ab8e34483cc0fb8f6af8/screenshot-filter.c#L106-L109

synap5e commented 4 years ago

So this was more complicated than just using width. The original image was using a 32-aligned linesize (based on cpu word sizes), it was necessary to encode using a 4-aligned linesize and truncate each line when copying into the buffer. This explains why I used linesize / 4 not width, since I was somewhat confused about that...

If you would like to try 1.3.0rc1 this should solve the issue.