# How to get dimensions of a Texture 2DDynamic?

**URL:** <https://forums.unrealengine.com/t/how-to-get-dimensions-of-a-texture-2ddynamic/429272>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [July 12, 2018, 12:41pm UTC](https://forums.unrealengine.com/t/how-to-get-dimensions-of-a-texture-2ddynamic/429272 "2018-07-12T12:41:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_e6e94cb6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e6e94cb6](https://forums.unrealengine.com/u/anonymous_user_e6e94cb6)\
**Post date:** [July 12, 2018, 12:41pm UTC](https://forums.unrealengine.com/t/how-to-get-dimensions-of-a-texture-2ddynamic/429272/1 "2018-07-12T12:41:26Z")

</div>

I’m downloading images from an url with the download image node. This gives me a Texture 2DDynamic which I have been able to successfully display on a widget. The images may be of different size and I would therefore like to be able to get the dimension (X and Y size) of the image to be able to resize the canvas panel slot where my image component resides in the widget. So I’m looking for something similar to the [get size x and get size y](https://answers.unrealengine.com/questions/55554/how-to-get-texture-size-in-pixels.html) which works for a _Texture2D_ but not for a _Texture 2DDynamic_.

---

<div class="post-metadata">

**Author:** ![Vaidas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Vaidas](https://forums.unrealengine.com/u/Vaidas)\
**Post date:** [April 26, 2020, 8:08am UTC](https://forums.unrealengine.com/t/how-to-get-dimensions-of-a-texture-2ddynamic/429272/2 "2020-04-26T08:08:15Z")

</div>

I have the same issue and I cannot find a solution.

If I cannot get the dimensions, could I at least get the aspect ratio of the downloaded image?

---

<div class="post-metadata">

**Author:** ![Vecherka](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Vecherka](https://forums.unrealengine.com/u/Vecherka)\
**Post date:** [May 1, 2020, 11:51am UTC](https://forums.unrealengine.com/t/how-to-get-dimensions-of-a-texture-2ddynamic/429272/3 "2020-05-01T11:51:59Z")

</div>

Hello asjobom and Vaidas,

the Texture 2D Dynamic stores it’s size in two public variables, namely SizeX and SizeY. You could write a simple Blueprint Function Library to expose them to Blueprint.

For example:

This goes inside the Blueprint Function Libary header file:

```
UFUNCTION(BlueprintCallable)
static int32 GetTexture2DDynamicWidth(UTexture2DDynamic* InTexture2DDynamicReference);

```

Important to note, you’ll need this include:

```
#include "Engine/Texture2DDynamic.h"

```

And this goes into the .cpp file:

```
int32 UMyBlueprintFunctionLibrary::GetTexture2DDynamicWidth(UTexture2DDynamic* InTexture2DDynamicReference)
{
	if (!InTexture2DDynamicReference)
	{
		return -1;
	}

	return InTexture2DDynamicReference->SizeX;
}

```

And the same goes for the height (or SizeY) you can make a second function or combine them it’s up to you.

Hope that helps. Just let me know if you need further assistance.

Regards,

Vecherka.

---

<div class="post-metadata">

**Author:** ![feralmoans](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/feralmoans/32/974428_2.png) [@feralmoans](https://forums.unrealengine.com/u/feralmoans)\
**Post date:** [April 30, 2022, 12:00pm UTC](https://forums.unrealengine.com/t/how-to-get-dimensions-of-a-texture-2ddynamic/429272/4 "2022-04-30T12:00:55Z")

</div>

This solved hours of headaches, thank you so much!

Not sure why SizeX and SizeY aren’t exposable to Blueprints by default but they really should be!

---

<div class="post-metadata">

**Author:** ![BBB](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bbb/32/719040_2.png) [@BBB](https://forums.unrealengine.com/u/BBB)\
**Post date:** [September 14, 2023, 3:44am UTC](https://forums.unrealengine.com/t/how-to-get-dimensions-of-a-texture-2ddynamic/429272/5 "2023-09-14T03:44:49Z")

</div>

SizeX and SizeY should be exposed to blueprint. @epic

---

<div class="post-metadata">

**Author:** ![ZaharKostic](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ZaharKostic](https://forums.unrealengine.com/u/ZaharKostic)\
**Post date:** [September 14, 2023, 12:57pm UTC](https://forums.unrealengine.com/t/how-to-get-dimensions-of-a-texture-2ddynamic/429272/6 "2023-09-14T12:57:37Z")

</div>

> [@Vecherka](#):
>
> `UTexture2D`

its included in the Volumetrics plugin which goes with the engine.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/6/e/66e2a48a77d95fe7be3a620d8354d907bb1ef175.png)
