How can I get the width and height of a texture in pixels?

Hi, i am working on some HUD modules, and i have a texture. I need that specific texture size so that i can resize it… etc. But i can not find any node that will give me Widht and Height of texture. Anyone knows?

Hey wmbuRn,

If you have your texture referenced in a Texture2D variable, you can call the functions Get Size X and Get Size Y to get the size, in pixels, in the X-Y directions.

Hope that helps out!

-Steve

No, i dont have texture referenced. How to reference a texture? Am working in blueprint btw

First you’ve got to add a variable to your blueprint for a Texture2D (left hand menu as default - click the variable button). Assign your texture to that.

Then just pull the variable into your event graph and then you can call Rendering->Texture->GetSizeX to get the X size in pixels (or Y) as stated above.

1 Like

Thank you, it did the job.

How can I assign a texture to Texture2D in runtime?