# Scaling sprites to original image size

**URL:** <https://discourse.threejs.org/t/scaling-sprites-to-original-image-size/55471>\
**Category:** Questions\
**Tags:** sprites, textures\
**Created:** [August 29, 2023, 8:24am UTC](https://discourse.threejs.org/t/scaling-sprites-to-original-image-size/55471 "2023-08-29T08:24:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![naticarl](https://avatars.discourse-cdn.com/v4/letter/n/b4bc9f/32.png) [@naticarl](https://discourse.threejs.org/u/naticarl)\
**Post date:** [August 29, 2023, 8:24am UTC](https://discourse.threejs.org/t/scaling-sprites-to-original-image-size/55471/1 "2023-08-29T08:24:08Z")

</div>

Hello,

I would like to scale sprites according to the size of the original image.

Example:  
image 1 = (50px, 50px)  
image 2= (100px,100px)  
Then the sprite with the second image should be displayed twice as large.

However, I cannot find the original image size anywhere.  
Is there a way to get the original image size for a sprite?

Thank you for your help!

---

<div class="post-metadata">

**Author:** ![PavelBoytchev](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/pavelboytchev/32/38639_2.png) [@PavelBoytchev](https://discourse.threejs.org/u/PavelBoytchev)\
**Post date:** [August 29, 2023, 8:38am UTC](https://discourse.threejs.org/t/scaling-sprites-to-original-image-size/55471/2 "2023-08-29T08:38:28Z")

</div>

To get the dimensions (in pixels) of the image in a sprite’s texture, try these:

```javascript
sprite.material.map.image.height
sprite.material.map.image.width

```

or these

```javascript
sprite.material.map.image.naturalHeight
sprite.material.map.image.naturalWidth

```

Note that `sprite.material.map` is the texture used for the sprite and its `image` property should be accessed only after the complete loading of the texture.

---

<div class="post-metadata">

**Author:** ![naticarl](https://avatars.discourse-cdn.com/v4/letter/n/b4bc9f/32.png) [@naticarl](https://discourse.threejs.org/u/naticarl)\
**Post date:** [August 29, 2023, 9:38am UTC](https://discourse.threejs.org/t/scaling-sprites-to-original-image-size/55471/3 "2023-08-29T09:38:19Z")

</div>

> [@PavelBoytchev](#):
>
> Note that `sprite.material.map` is the texture used for the sprite and its `image` property should be accessed only after the complete loading of the texture.

I tried it and it works 🙂

Your note was the essential information that I needed:

> Note that `sprite.material.map` is the texture used for the sprite and its `image` property should be accessed only after the complete loading of the texture.

Thank you for the (very) quick response!
