Help needed with creating a simple Frame Filter

Hey there,
I’m completely new to Spark AR and completely clueless.
I want to make a filter, where the background is completely white and the image from the camera (or existing media) just gets centered in the middle, just a bit scaled down.

For the image from the device I found a working solution, but with the existing media I get into some trouble. When I upload a for example a square image, the screen gets some weird grey boarders on top and bottom, even though the white background should be filling the whole device screen.

Maybe someone got a hint what I’m doing wrong or how to fix it?
Thanks in advance!

Have you checked this project? Detecting gallery texture state changes

I looked into it and tried, but somehow still end up with the grey boarders top and bottom

Oh, sorry for some reason I thought this project was using Fit2Rect. If you want it to extend to the height, you can do this instead:

If you always want it to cover the screen, you can compare the aspect of the screen to the aspect of the media and use an if/else to decide which scaling strategy to use.

I updated the project to use fit2rect so you don’t have to think about any of the mathy stuff. See this thread for more info: GitHub - positlabs/spark-gallery-texture-state: Test case for gallery texture size and state changes