How to set the size of a UI element in pixel?

How can I set the size of a UI element in pixel without it changing its size through changing the viewport size?

I want an UI Image to be 512 pixel in width but whatever I do it changes it size when I change the viewport size. I’m using a size box element and the width override of it, inside is is a overlay with the image element inside. I need to be able to change the width override in Blueprint.

I found a workaround:

This is what scales it based on viewport size, you could also make the curve flat instead but then you have fixed pixel sizes for every UI element which is rarely what you want:

Copying that curve in a BP you can do this:

Needs to be then updated when the viewport size changes, like window scaling or resolution change

Your UI element needs to be in that referenced size box and it needs to have Size To Content, Width Override and Height Override set to True