SupMover icon indicating copy to clipboard operation
SupMover copied to clipboard

[Feature Request] Tonemap to a specific color code

Open vevv opened this issue 1 year ago • 4 comments

It would be nice to be able to specify a target hex color code like in subtitle_tonemap, should be pretty easy to add (just split to R/G/B and calculate, e.g. #a7a7a7 -> 167/167/167 -> (167/255) * 100 -> 65%).

edit: It seems you have to use the main color's code instead of 255 (e.g. 204) works, and it's the same way Subtitle Edit's percentage works.

I guess you would need to find the brightest color present in the subtitles, use that as reference, and calculate a percentage off of that to change other colors.

vevv avatar Jul 22 '24 13:07 vevv

Hi @vevv, well, in reality is not that easy, subtitle_tonemap works on RGB while my tool works on the YUV palettes and to map quietvoid's functionality to mine i'd need to implement conversion and handling of YUV color or RGB color for the input parameters taking into account also BT709 or BT470BG matrix when doing the conversion, I'll think about it.

MonoS avatar Jul 23 '24 07:07 MonoS

Wait, YUV? I thought the entire format is just RGB images, which is why HDR subs are just darker.

In any case, if you could get this implemented, it would be very much appreciated!

vevv avatar Jul 26 '24 19:07 vevv

I've kind of implemented this functionality in the past days, it's working as i wrote it, but it's not working as intended, i can upload a test version here if you want to see how it's not working.

MonoS avatar Dec 07 '24 23:12 MonoS

Sure, I'm interested.

Also, I've learned recently that SupMover may not be handling tonemap correctly, with regards to colors (only Y is handled, Cb and Cr are left as is). This is not a big problem as most subtitles are black and white/gray though. AFAIK to do it fully correctly on full-color images, you would also need to handle colorspace conversion to avoid over saturated images when the subs are displayed on HDR video (or the other way round).

vevv avatar Dec 09 '24 10:12 vevv