Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image producer options #1564

Open
dimitry-ishenko opened this issue Sep 18, 2024 · 7 comments
Open

Image producer options #1564

dimitry-ishenko opened this issue Sep 18, 2024 · 7 comments

Comments

@dimitry-ishenko
Copy link
Contributor

Description

Currently the image producer will stretch the image to fill the output frame. Sometimes we get images with various sizes and formats that need to be quickly shown preserving the aspect ratio. This has resulted in some unwanted results, such as people being stretched. I know there are mixer commands that can be used for that, but they require calculating image aspect ratio vs channel aspect ratio, and take too long.

It would be very useful to add several parameters to the image producer, that regulate how the image is processed. They would be:

PLAY 1-10 image STRETCH
PLAY 1-10 image FILL
PLAY 1-10 image FIT
PLAY 1-10 image VFILL
PLAY 1-10 image HFILL

If the parameter is omitted, it defaults to STRETCH, which is the current behavior. The parameters would do the following:
Screenshot from 2024-09-18 10-52-36

Solution suggestion

It should be fairly simple to implement using FreeImage_EnlargeCanvas and I've been meaning to take a stab at it for a while.

@Julusian
Copy link
Member

I think it would be better to do this on the mixer rather than inside the image producer, as other producers would also benefit from this. And that will avoid more cpu heavy work when loading an image, is already is doing more than I would like (converting to 8bit rgb, pre-multiplying alpha)
I did write this on 2.1, but never had a reason to port it to 2.3/2.4

nrkno@0e51c7d

@Sidonai-1
Copy link

If the parameters are implemented in the mixer it could apply to videos as well, not only images?

We use the mixer commands a lot for this reason. We got used to it, but yeah those options would come in handy for sure.

I'm not sure I understand what fit does, so maybe I'm wrong, but I'd say I'm missing an extra option: play it as is, without filling or fitting into the channel. One example is a 90×90 QR Code into a 1080 channel. Just play it on its original resolution. It that what "fit" does?

@dimitry-ishenko
Copy link
Contributor Author

I'm not sure I understand what fit does

@Sidonai-1 FIT expands/shrinks the image to make it fit on the screen without cropping.

Just play it on its original resolution.

That should be another option also.

@dimitry-ishenko
Copy link
Contributor Author

I think it would be better to do this on the mixer rather than inside the image producer, as other producers would also benefit from this. And that will avoid more cpu heavy work when loading an image, is already is doing more than I would like (converting to 8bit rgb, pre-multiplying alpha) I did write this on 2.1, but never had a reason to port it to 2.3/2.4

nrkno@0e51c7d

@Julusian to make sure I understand it correctly, this PR adds SCALE_MODE parameter to the various producers that controls scaling mode?

@dimitry-ishenko
Copy link
Contributor Author

@Julusian if you don't mind, I will try to port your PR to 2.4

@Julusian
Copy link
Member

Yes, that change adds a parameter to the AMCP PLAY/LOAD commands such as SCALE_MODE FIT.
It looks like it has to be implemented by each producer separately (such is the nature of the AMCP implementation), but at least then it can be used by every producer, once someone adds support to them.

Please do!
I think this feature was a case of something needed for a prototype, but then that prototype setup got shelved/abandoned so it never got ported to 2.4 when nrk moved across, so its likely still on a todo list to do so if that gets picked up again.
No reason not to port it though

In case its useful, there was a pr for it nrkno#28 and another issue about it over here #673

@dimitry-ishenko
Copy link
Contributor Author

dimitry-ishenko commented Sep 18, 2024

Submitted PR #1566 if anyone wants to try it. The only inconvenient part is that it requires two commands to be run first:

MIXER 1 ANCHOR .5 .5
MIXER 1 FILL .5 .5 1 1

in order for the images to be centered. Otherwise, it works great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants