# Defold now has TexturePacker support

**URL:** <https://forum.defold.com/t/defold-now-has-texturepacker-support/76557>\
**Category:** Announcements\
**Created:** [April 12, 2024, 8:05am UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557 "2024-04-12T08:05:20Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 12, 2024, 8:05am UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/1 "2024-04-12T08:05:20Z")

</div>

[![](https://defold.com/extension-texturepacker/example1.png) ](https://defold.com/extension-texturepacker/example1.png)

Manual: [TexturePacker documentation](https://defold.com/extension-texturepacker/)  
GitHub: [GitHub - defold/extension-texturepacker: Adds support for the TexturePacker atlas format · GitHub](https://github.com/defold/extension-texturepacker)

We have now added support for packed atlases, via the [TexturePacker](https://www.codeandweb.com/texturepacker) tool.

Packed atlases refers to the images being tightly packed, using polygonal shapes, in order to fit more images into a single texture page. There are several benefits to this.

- Less overdraw with empty texels (via polygonal shapes)
- Smaller memory footprint on GPU
- Smaller download sizes

We have introduced two new file formats:

- .tpinfo: The data describing the image layouts
- .tpatlas: The data describing the flipbook animations in an atlas

# Extension

This is implemented as an editor/pipeline extension (i.e. not runtime), and you’ll need to add the extension to the `dependencies` in `game.project`.

As usual, pick the latest release from the [releases pages](https://github.com/defold/extension-texturepacker/releases).

# TexturePacker setup

To keep setup information in one place, we’ll refer to the [extension manual](https://defold.com/extension-texturepacker/) on how to set this up.

# Data format

While we used [TexturePacker](https://www.codeandweb.com/texturepacker) as a base implementation, we also intended these new data formats to be used by potential other exporters.

The formats are defined text (using the Protobuf format), and you can find the definitions (.proto) [here](https://github.com/defold/extension-texturepacker/tree/main/texturepacker/pluginsrc).

Using these formats, you can write an exporter from other tools, or write your own scripts to generate a packed atlas.

# Future

While this support was a heavily requested feature, we realize not everyone can afford a TexturePacker license. So we plan to make similar functionality available to our users within our own ecosystem.  
We are currently [doing experiments](https://twitter.com/mwesterdahl76/status/1644720490336997377) along this route and we hope to do some testing this year.

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 13, 2024, 7:24am UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/2 "2024-04-13T07:24:51Z")

</div>



---

<div class="post-metadata">

**Author:** ![Pkeod](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pkeod/32/606_2.png) [@Pkeod](https://forum.defold.com/u/Pkeod)\
**Post date:** [April 13, 2024, 3:32pm UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/3 "2024-04-13T15:32:47Z")

</div>

Great to see this! Will help a ton when optimization really matters!

---

<div class="post-metadata">

**Author:** ![Jay\_Cee](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/jay_cee/32/34527_2.png) [@Jay\_Cee](https://forum.defold.com/u/Jay_Cee)\
**Post date:** [April 13, 2024, 4:36pm UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/4 "2024-04-13T16:36:19Z")

</div>

I believe I mentioned this before but I have a modified version of free-texure-packer that works well. This is basically a trimmed down version of TP

[https://github.com/jcbk101/free-tex-packer](https://github.com/jcbk101/free-tex-packer)

---

<div class="post-metadata">

**Author:** ![AndreasLoew](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/andreasloew/32/31498_2.png) [@AndreasLoew](https://forum.defold.com/u/AndreasLoew)\
**Post date:** [April 14, 2024, 9:39am UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/5 "2024-04-14T09:39:23Z")

</div>

I am Andreas from CodeAndWeb, the Developers of [TexturePacker](https://www.codeandweb.com/texturepacker).

I absolutely love that you’ve integrated the support for our **Polygon Packer**. This is really a huge advantage over rectangular packed sprite sheets - both in terms of sprite sheet size (memory usage) and performance. 😃

We decided to integrate the exporter into TexturePacker directly, so that it’ll works out of the box with the next update!

About affording TexturePacker:

- **Pay once and use it forever** - no subscription. The license contains updates for 1 year, after that you can continue to use the latest release within that period - or get an update license.
- **Free support** : Send us a mail and we’ll help you with all TexturePacker related problems.
- We offer a [**50% discount**](https://www.codeandweb.com/store/texturepacker-single) for a single user license to independent developers - with this, you can get a license for less than **23$** or **25€**.

We keep on improving it with new features and bug fixes - since 14 years! Many users bought the tool a long time ago and still use it after years.

---

<div class="post-metadata">

**Author:** ![AndreasLoew](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/andreasloew/32/31498_2.png) [@AndreasLoew](https://forum.defold.com/u/AndreasLoew)\
**Post date:** [April 15, 2024, 3:23pm UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/6 "2024-04-15T15:23:26Z")

</div>

I’ve just uploaded TexturePacker 7.3.0 - it now contains the Defold exporter.

**No need for manual installation of the exporter!**

Some hints for all users:

- The default packing mode is set to MaxRects - this is a fast packing algorithm. The sprites are all represented as polygons but the layout is rectangle based.
- If you want to further reduce the sprite sheet size, set **Layout → Algorithm = Polygon**. It’s a bit slower but usually results in better packing.

@Mathias_Westerdahl You are enforcing power-of-2 sized textures. Is this really needed? Or would a multiple of 8 suffice - this should work on all modern devices and allow all kinds of hardware compression.

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 15, 2024, 4:44pm UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/7 "2024-04-15T16:44:54Z")

</div>

The power-of-two is an old requirement, and I don’t think any of our platforms actually require it anymore.  
We will have to investigate and test a bit before removing that constraint though.  
Perhaps better to do it later on, when we’ll add pivot support as well.

---

<div class="post-metadata">

**Author:** ![AndreasLoew](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/andreasloew/32/31498_2.png) [@AndreasLoew](https://forum.defold.com/u/AndreasLoew)\
**Post date:** [April 15, 2024, 6:08pm UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/8 "2024-04-15T18:08:47Z")

</div>

Ok - perfect. Let me know when you want to do that. You can contact me directly at support at [codeandweb.com](http://codeandweb.com) . I can then directly integrate the updated exporter.

---

<div class="post-metadata">

**Author:** ![Dragosha](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dragosha/32/5103_2.png) [@Dragosha](https://forum.defold.com/u/Dragosha)\
**Post date:** [April 26, 2024, 9:23am UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/9 "2024-04-26T09:23:06Z")

</div>

There seems to be some issues with importing atlas exported in **MaxRects** mode. On the screenshot you can see that some trim polygons didn’t match the images, maybe not rotated 90 degrees or something like that.

 ![2024-04-26_13-18-36](https://forum-defold-uploads.b-cdn.net/original/3X/1/c/1c10e1c4ca209321a0c58c40eb65a40fcaebaa1f.png)

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 26, 2024, 9:28am UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/10 "2024-04-26T09:28:03Z")

</div>

Is it rendering in the engine ok, or is it wrong there as well?

---

<div class="post-metadata">

**Author:** ![Dragosha](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dragosha/32/5103_2.png) [@Dragosha](https://forum.defold.com/u/Dragosha)\
**Post date:** [April 26, 2024, 9:34am UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/11 "2024-04-26T09:34:29Z")

</div>

As far as I can see both in the editor and in runtime.

Here you can see how the first sprite in the animation is marked up incorrectly.

  
 ![2024-04-26_13-19-15](https://forum-defold-uploads.b-cdn.net/original/3X/a/1/a12832eacf1dc3e6db8dd1a16e1b8155bc115c5b.png)  
 ![2024-04-26_14-36-31](https://forum-defold-uploads.b-cdn.net/original/3X/1/3/13ffb66bb5ff545f38baabba1ca4f4aa2b98e7ea.png)

With **Polygon** algorithm all seems correct:

 ![2024-04-26_14-38-24](https://forum-defold-uploads.b-cdn.net/original/3X/3/7/371a0382fa7f06cb548ddb476fe293f3dce57ba3.png)

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 26, 2024, 10:06am UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/12 "2024-04-26T10:06:46Z")

</div>

Then I wonder if it’s due to the exprter itswlf.  
Would it be possible to share the .tps project and images with me?

---

<div class="post-metadata">

**Author:** ![Dragosha](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dragosha/32/5103_2.png) [@Dragosha](https://forum.defold.com/u/Dragosha)\
**Post date:** [April 26, 2024, 2:39pm UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/13 "2024-04-26T14:39:37Z")

</div>

Also, which trim modes are supported?  
I see trim mode `trim` does not any affect to viewport, just rendering empty space instead a sprite.

 ![2024-04-26_19-32-30](https://forum-defold-uploads.b-cdn.net/original/3X/5/b/5bb87973120e83c75c6f7806d05af1d748f0befc.png)

and only `polygon outline` trim mode is workable:

 ![2024-04-26_19-34-24](https://forum-defold-uploads.b-cdn.net/original/3X/1/a/1a9b9e59d3a66cab924135ad0afb286e3e6b7ab4.png)

> [@Mathias\_Westerdahl](#):
>
> Would it be possible to share the .tps project and images with me?

done

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 26, 2024, 3:54pm UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/14 "2024-04-26T15:54:54Z")

</div>

I guess there’s a difference in the TP exporter when the trim mode is used. I would have thought it would generate a polygon anyways. But I’ll debug some more to see what I can find out.

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 27, 2024, 3:19pm UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/15 "2024-04-27T15:19:18Z")

</div>

I have 2 PR’s coming up for the rotation issue:  
[https://github.com/defold/extension-texturepacker/pull/3](https://github.com/defold/extension-texturepacker/pull/3)  
[https://github.com/defold/defold/pull/8863](https://github.com/defold/defold/pull/8863)

I also added a ticket for adding box packing (Trim mode):  
[https://github.com/defold/extension-texturepacker/issues/4](https://github.com/defold/extension-texturepacker/issues/4)

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 29, 2024, 9:28am UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/16 "2024-04-29T09:28:38Z")

</div>

I have pushed a fix to the extension-texturepacker, and also to our dev branch:

> **[Release v1.8.1 - alpha · defold/defold](https://github.com/defold/defold/releases/tag/1.8.1-alpha)**
>
> Defold version 1.8.1
> Engine channel=alpha sha1: 609ede3
> Editor channel=alpha sha1: 609ede3
> date = 2024-05-28 13:45:20

If you can help verify the fix, we should be able to move that PR into a hotfix for 1.8.0

---

<div class="post-metadata">

**Author:** ![Dragosha](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dragosha/32/5103_2.png) [@Dragosha](https://forum.defold.com/u/Dragosha)\
**Post date:** [April 29, 2024, 1:49pm UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/17 "2024-04-29T13:49:07Z")

</div>

Unfortunately I’m not able to test the changes, maybe I’m getting something plugged in wrong.  
I downloaded 1.8.1 version of Defold. Attached to the project [https://github.com/defold/extension-texturepacker/archive/refs/heads/main.zip](https://github.com/defold/extension-texturepacker/archive/refs/heads/main.zip) instead of version 1.0.  
Installed a custom exporter in Texture Packer. But I’m not sure if this is the correct version. The framework menu shows one version of Defold, (could be an embedded version?).

 ![2024-04-29_18-45-00](https://forum-defold-uploads.b-cdn.net/original/3X/9/9/99c573d0c032238b6afc8854885434d69588cf9c.png)

Defold:

 ![2024-04-29_18-45-36](https://forum-defold-uploads.b-cdn.net/original/3X/a/5/a53ced2c6060b5052c62f284af16a76d6aa13146.png)

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 29, 2024, 1:52pm UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/18 "2024-04-29T13:52:02Z")

</div>

Yeah, it might be the embedded version in TP.  
When exporting, the “.tpinfo” file should contain a new version number “1.1”.  
You could try temporarily moving the embedded exporter in the TP installation?

---

<div class="post-metadata">

**Author:** ![Dragosha](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dragosha/32/5103_2.png) [@Dragosha](https://forum.defold.com/u/Dragosha)\
**Post date:** [April 29, 2024, 2:09pm UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/19 "2024-04-29T14:09:17Z")

</div>

> [@Mathias\_Westerdahl](#):
>
> You could try temporarily moving the embedded exporter in the TP installation?

I tried it. The polygons have changed, but there are still shifts relative to the original

 ![2024-04-29_19-07-35](https://forum-defold-uploads.b-cdn.net/original/3X/3/0/307a9e80e4a8805ce0a6b3dbf2679a654d491809.png)

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 29, 2024, 2:10pm UTC](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557/20 "2024-04-29T14:10:18Z")

</div>

Thanks for testing, then I have some more work to do 🤔

[Next page](https://forum.defold.com/t/defold-now-has-texturepacker-support/76557.md?page=2)
