rTexPacker

A simple and easy-to-use textures packer and font atlas generator.

What can I do with rTexPacker?

rTexPacker is a powerful tool to package sprites or fonts into an atlas, to improve drawing performance on games. Multiple images can be automatically organized (packed) into a single bigger image, as well as the multiple text characters of a font required by a game. Packaging method can be configured with several option like packaging algorithm, padding and spacing between image.

Sprite origin can be defined and exported on the atlas descriptor file. Sprite shaders can be applied for special visual effects.

With rTexPacker you can easely package sprites and export atlas information in multiple formats (XML, JSON, CODE...).

Features

  • Package sprites and font glyphs into an atlas
  • Configure packing algorithms and heuristics
  • Setup sprites spacing, padding and alpha-trimming
  • Font generation options: Size, SDF fonts, fixed font height
  • Import custom unicode charset from UTF-8 file
  • Unicode charset duplicates removed automatically
  • Edit sprites origin visually, exported with the atlas
  • Apply per-sprite shaders for special effects
  • Atlas visualization options: Zoom, Pan, Background, Fill
  • Multiple UI styles available, selectable from main toolbar
  • Load/Save portable self-contained .rtp file, containing all sprites
  • Load sprites from multiple image formats: .png, .qoi, .tga, .jpg
  • Load sprites from font files: .ttf, .otf
  • Export atlas descriptor as: text (.rtpa), binary (.rtpb), .json, .xml and code (.h)
  • Export atlas image as: .png, .qoi, .dds and .raw
  • Export atlas descriptor as binary PNG chunk: rTPb
  • Export missing font codepoints from requested list
  • Multiple usage examples provided to load: .rtpa, .rtpb, PNG chunk rTPbp and code .h.
  • Maximum atlas size up to 16384x16384 pixels
  • Application initialization configuration automatically saved
  • Command-line support for batch sprites packing
  • Completely portable (single-file, no-dependencies)

Basic Usage

Open the tool, drag & drop your sprites/fonts and setup atlas packing options.

Generated atlas can be exported as atlas-descriptor text file plus an atlas image file. The formats supported are:

  • Atlas Descriptor: text (.rtpa), binary (.rtpb), .xml, .json and code (.h)
  • Atlas Image: .png, .qoi, .dds and .raw

rTexPacker dektop version comes with command-line support for batch sprite packaging and font atlas generation.

rtexpacker.exe --help

Keyboard/Mouse Shortcuts

  • F1 - Show Help window
  • F2 - Show About window
  • F3 - Show Sponsor window

File Options

  • LCTRL + N - New atlas project (.rtp)
  • LCTRL + O - Load atlas project (.rtp)
  • LCTRL + S - Save current atlas project (.rtp)
  • LCTRL + E - Export current atlas project
  • LCTRL + X - Close current atlas project

View Options

  • F5 - Toggle Sprites window
  • F6 - Toggle Atlas Settings window
  • R - Toggle Sprites rectangles
  • O - Toggle Sprites origins

Atlas Controls

  • MOUSE WHEEL - Zoom in/out
  • MOUSE MIDDLE BTN - Image Panning
  • F - Zoom and center atlas to screen

Sprite Controls

  • MOUSE LEFT BUTTON - Select sprite(s) rectangle
  • LCTRL + MOUSE LEFT BTN - Select/unselect sprites
  • G - Toggle selected sprite origin edition mode
  • D - Zoom and center selected sprite to screen
  • LSHIFT + LEFT - Move selected sprite left on list
  • LSHIFT + RIGHT - Move selected sprite right on list
  • DELETE - Remove selected sprite

Sprite Shader Controls

  • J - Set shader for selected sprite(s)",
  • LCTRL + J - Toggle shader for selected sprite(s)",
  • U - Unload shader, return to default shader",

Command-line

  USAGE:\n\n");
    > rtexpacker [--help] --input <directory>,[file01.ext],[file02.ext] [--output <filename.ext>]
                 [--atlas-desc <value>] [--atlas-image <value>]
                 [--atlas-format <value>] [--atlas-size <value>]
                 [--pack-algorithm <value>] [--pack-heuristic <value>]
                 [--padding <value>] [--trim-alpha] [--debug]
                 [--font-size <value>] [--font-charset <file.txt>]
                 [--font-force-height] [--font-force-width] [--font-sdf]
  OPTIONS:\n
    -h, --help                      : Show tool version and command line usage help
    -i, --input <directory>,[file01.ext],[file02.ext]...
                                    : Define input files. Comma separated:
                                        Directories to scan: <no extension>
                                        Multiple sprites: .rtp, .ttf, .otf
                                        Single sprites:   .png, .qoi, .bmp, .tga, .jpg, .jpeg
    -o, --output <filename.ext>     : Define output filename.
                                      Supported extensions: .rtpa, .rtpb, .xml, .json, .h
                                      NOTE: If not specified, defaults to: atlas.rtpa + atlas.png
    -ad, --atlas-desc <value>       : Define atlas descriptor output format:
                                        0 - TEXT (.rtpa)
                                        1 - BINARY (.rtpb)
                                        2 - XML (.xml)
                                        3 - JSON (.json)
                                        4 - CODE (.h)
    -ai, --atlas-image <value>      : Define atlas image output format:
                                        0 - PNG (.png)
                                        1 - QOI (.png)
                                        2 - DDS (.dds)
                                        3 - RAW (.raw)
    -af, --atlas-format <value>     : Define atlas image output pixel format:
                                        0 - GRAYSCALE
                                        1 - GRAY + ALPHA
                                        2 - R5G6B5
                                        3 - R8G8B8
                                        4 - R5G5B5A1
                                        5 - R4G4B4A4
                                        6 - R8G8B8A8 (default)
    -as, --atlas-size <value>       : Define atlas size: 128,256,512,1024,2048,4096,8192,16384\n
    -pa, --pack-algorithm <value>   : Define atlas packing algorithm
    -ph, --pack-heuristic <value>   : Define atlas packing heuristic
    -pd, --padding <value>          : Define sprites padding
    -sp, --spacing <value>          : Define sprites spacing in atlas
    -ta, --trim-alpha               : Define sprites alpha trimming
    -fs, --font-size <value>        : Define font size (height)
    -fc, --font-charset <file.txt>  : Use provided charset to generate atlas
    -fh, --font-force-height        : Force font height for all glyphs
    -fw, --font-force-width         : Force font monospace width
    -sdf, --font-sdf                : Generate SDF font
    -db, --debug-background         : Draw MAGENTA background into atlas image
    -dl, --debug-lines              : Draw sprite bound lines into atlas image
    -do, --debug-origins            : Draw sprite origin point into atlas image
    -pr, --png-rtpb                 : Export rTPb chunk in PNG atlas image
  EXAMPLES:\n
    > rtexpacker --input resources --output atlas.rtpa
        Process <resources> directory to generate <atlas.rtpa> + <atlas.png>
    > rtexpacker --input sprite01.png,sprite02.tga,sprite03.jpg --output atlas.json
        Process <sprite01.png>,<sprite02.tga>,<sprite03.jpg> to generate <atlas.json> + <atlas.png>
    > rtexpacker --input myatlas.rtp -ta -d
        Process <myatlas.rtp> to generate <atlas.rtpa> + <atlas.png> with sprites trimmed and debug rectangles
    > rtexpacker --input Arial.ttf --output atlas.xml -fs 32 -sdf
        Process <Arial.ttf> font to generate <atlas.xml> + <atlas.png>, font size 32 and SDF font

Technologies

This tool has been created using the following open-source technologies:

  • raylib - A simple and easy-to-use library to enjoy videogames programming
  • raygui - A simple and easy-to-use immediate-mode-gui library
  • rpng - A simple and easy-to-use library to library to manage png chunks
  • rini - A simple and easy-to-use config init files reader and writer
  • tinyfiledialogs - File dialogs for desktop platforms

Handmade Software

rTexPacker is handmade software, it has been meticulously developed using the C programming language, with great attention put on each code line written. This approach usually results in highly optimized and efficient code, but it is also more time-consuming and require a higher level of technical skills. The result is great performance and small memory footprint.

rTexPacker is self-contained in a single-executable of about 1 MB, it could fit on a floppy disk.

Issues & Feedback

Note that the one-time-payment desktop version of rTexPacker comes with no support. Still, tool issues and feedback can be reported at https://github.com/raylibtech/rtools. They are reviewed with low-priority.

For additional support, priority issues review or tool customization requirements, please contact ray[at]raylibtech.com

License

The use of rTexPacker desktop application is subject to the terms and conditions of the End User License Agreement. By using rTexPacker, the user agrees to be bound by the terms of the EULA.

Check included End User License Agreement document for details (EULA.txt).

Copyright (c) 2019-2024 raylib technologies (@raylibtech) | Ramon Santamaria (@raysan5)

StatusReleased
CategoryTool
PlatformsHTML5, Windows, macOS, Linux
Rating
Rated 5.0 out of 5 stars
(12 total ratings)
Authorraylib technologies
Made withraylib
Tagspacker, raygui, raylib, Textures, tool
Average sessionAbout an hour
LanguagesEnglish
InputsKeyboard, Mouse
LinksSteam, Homepage, Twitter/X, Steam, LinkedIn

Purchase

Buy Now$19.95 USD or more

In order to download this tool you must purchase it at or above the minimum price of $19.95 USD. You will get access to the following files:

rTexPacker v2.0 Usage Code Samples 2.3 MB
rTexPacker v4.0 Windows (x64) 2.8 MB
rTexPacker v4.0 Linux (x64) (X11 + Wayland) 2.8 MB
rTexPacker v4.0 macOS (x64 + arm64) 3.3 MB

Development log

Comments

Log in with itch.io to leave a comment.

This is a very nice interface and tool for what it does and I appreciate releases like this.

If I may, I feel it has much more potential. For example, if it were able to create slices on a single sprite rather than making the user add image files individually, this would be a huge plus to begin with.

On top of that, if it allowed per-slice data such as origin points and custom-named points (to be used in code for things like sprite rotation or otherwise) it would be even more useful.

Taking it further you could add slice data fields (for things like naming groups of slices on the atlas along with an ID of some kind, for example: GrassSprite 01, or string IDs and sub-IDs: "Scene", "Lobby", "Table", basically just user-defined data per slice. This would be immensely useful.

I have created something similar but your GUI is better, you have features I don't, and your interface is already set up to add the things I mentioned. I would definitely pay for a professional version of what I have described.

If you feel there is already a tool out there that does this kind of thing, or a reason why these ideas are not practical in a game-dev workflow, please let me know, since I may be missing something!

Keep up the good work on all your wonderful tools and above all, Raylib! Thanks for reading.

Hi! Actually I'm already working in some of the proposed features! 

I'm trying to support automatic sprite-slicing by alpha when loading a sprite containing an animation sequence but unfortunately I couldn't get it working yet.

The sprites custom tag/class has been in the roadmap for a long time and it's almost ready! Just testing the best way to expose it in the UI, at the moment I'm using a similar button to pivot-point-edit and a floating window... 

Thanks for the ideas!

(3 edits)

Thanks for your reply! I saw your Youtube interview about Raylib today, it was very nice to see and hear your comments and get to know the producer of this special library.

Glad to hear a custom tag feature is on the roadmap!

As for creating slices, simply drawing boxes would be sufficient for me. Then each box/slice could have the custom tags and points. I would appreciate up to at least two or three points.

Another idea is "zones" which could simply be boxes or any polygons within the slice. This could be used for defining no-walking zones, trigger zones, or even pseudo-vertical zones for testing 2D upright collisions - for example, whether or not a flying arrow hit a tree trunk. You would need a base poly or ellipse, and a vertical line/height point, which should be enough to create a psuedo-3D collision area for a 2D upright object. I have these things in my own game engine but have not developed all the features in an interactive GUI, many of them are coded. I stopped working on it in case such an advanced editor existed, but I'm not sure there is one.

With such features you are technically taking sprites to a kind of "object" level, using a GUI to give them a body of really practical data (as well as user-defined data) that's ready to be loaded and utilized by an engine. The output could be in various formats if needed, but any format would work for me. Just need the data! :)

Thanks for reading.

When I save a project (.rtp file), where does it gets saved?
I'm using the steam version on Linux (Fedora), and seemingly nothing happens.

Hi! I imagine you refer to the itch.io rTexPacker version, the Steam version is not available for Linux, only for Windows.

When you save a project a system dialog window should appear and ask for the path and filename to save your .rtp project, does it appear?

Please, could you report this issue to: https://github.com/raylibtech/rtools

I would be useful to move the pivot point with the arrow keys, to make small adjustments, right now you have to be precise with the mouse, which isn't great if you want a specific pixel.

It would also be nice to have buttons that set the pivot at specific predefined positions like centered, mid-bottom, etc. Even better if you could select a bunch of sprites and click those buttons to set it for all (eg: to set it to center in batch).

Thanks for your feedback! I take note for next release!

(9 edits)

While I can happily recommend (and even recommend sponsoring! go do it!) raylib, I sadly cannot recommend this software (rTexPacker).

  • the custom user interface is very small and inaccessible to use on mid-to-high dpi screens in windows. instead of 6 themes, I'd give the world for a "scale 200%" mode
  • the contrast on many of the buttons and ui elements is extremely low, including enabled elements
  • none of the fonts adheres to common legibility practices of modern UI
  • the "dark" theme is overall the best for legibility, but the contrast on greyed out buttons is comically the lowest
  • lots of interactions feel surprising or counterintuitive, and don't adhere to widespread UI standards
  • many actions are not discernible from the labels on the buttons, e.g. "trim sprites alpha"
  • there are no tooltips for most of the actual actions this tool performs
  • by default, the sprite view is filtered with LINEAR/LINEAR_MIPMAP (in a sprite packer? this should default to NEAREST)
  • zooming does not zoom to the mouse - it zooms... somewhere?
  • rTexPacker can't seem to import existing sprite sheets (filmstrip or otherwise) that contain multiple frames
  • individual UI elements "look" like windows in an MDI app, but the application does not work scaled to larger screens, all of the UI stays tiny and just moves apart impractically far. I expected every single one of them to be draggable, dockable, and resizable (in that order of priority)

It's not very expensive, but it was a mild disappointment - I'll not be switching to rTexPacker over TexturePacker.

(+1)

Hi tiger.blue, I’m sorry your experience with rTexPacker was not as good as I’d like to. Thanks for all the feedback provided, it seems most of the issues you listed are related to UI/UX, I’ll try to review some of them for next release. Thanks.

Thanks for understanding, I had a really hard time trying to use rTexPacker. UI/UX is the main concern indeed. (and a simple way to split filmstrip sprite sheets... but one can always go to ImageMagick for that)

Can rTextPacker generate sprite font atlases where every character has the same width, similarly to what is displayed in sprite view? This is important for pixel fonts for ex. to avoid a score bouncing around in game when the numbers change.

Thanks for the feedback. I take note of this feature for next release!

Great tool, I wish we can have something such as "TexUnpacker", Would be nice if we could detect sprites within a sprite sheet, and export data to the formats supported by the app, something like "Atlas Image Data Generator" app do but the interface there is buggy and not user very user friendly.

Implementing such a system is not trivial, it requires some work, many considerations and probably some limitations. For the moment it's out of scope but if I got more resources (time, money) I could consider working on it.

Great tool - enjoying using it so far. One small request though, would it be possible to add the option to toggle on/off texture filtering? When dealing with pixel art the blurring caused by bilinear filtering makes it a little more tricky to work with. Thanks!

Actually, there is a toggle button in the main toolbar just for that...

Oh perfect, I somehow missed that. Thanks!

Is there a quick way to set the origin of a frame (or all frames) to their centres?

I'm afraid there is no such option at this moment, pivot-point setup is manual for required sprites... but I take note for a future version!

Is it possible to make the program, output multiple atlases if the number of sprites overflow the atlases? Then a map can be made to lookup which atlas the sprite belongs too. If source could be provided, I could add the feature myself, but this is closed source. It would be possible to make this feature even just using the binary, but would be easier if it already does this or source is available, even in a limited context. Either way buying this later today.

Maybe in a future but now my resources are very limited to keep improving this tool. I prefer to keep it closed source, it took me thousands of hours of development and I’m trying to monetize a bit all that work.

(1 edit) (+1)

I am in now way saying you should open source the tool and not be able to monetize it. I simply wish for some way to access the source with purchase, even in a non redistributable limited license manner. I would be more than willing to sign any NDA or pay an extra fee or something, just because it would make my life easier, but if this is not possible, I understand completely.


I would also like to stress I am in no way ungrateful for all the work you do on raylib. It is a wonderful technology. I am using it now and appreciate everything you do. I have already purchased this software and completely understand any limitations you have to impose to insure your ability to make money. The fact you even offer the software for free as use as a web app is commendable from the outset, I have no issues paying you something for a small part of all the work you have done, and the existence of raylib brings me great joy in not having to re-implement many things when I create projects that I do not desire to use giant monolithic engines with. Thanks for everything you do Ray.

I was wondering if it is possible, when exporting the texture, to configure the number of channels per pixel? Specifically, if it is possible to export the texture in grayscale? This feature would be very helpful

keep up the good work

Actually, I considered that option but I decided to keep that image-editing functionality separate from the packaging functionality. You can use rTexViewer to edit the pixel-format of your exported atlas.

There seems to be a bug.

I packed a .png-image with color RGBA(0, 0, 0, 50) and the result was RGBA(0, 0, 0, 10).

Is there something wrong with the alpha values?

Yes, it’s a known issue and has already been reviewed. An updated version will be published soon.

Do you plan on making this a library?

Also is there a way to remove all viewable sprites in the atlas?  It'll be useful for fighting games that need a lot of sprites for animation.

What do you mean? There is a clean button on the sprites list to remove all sprites from the atlas.

There can be sprites that have a red border around them that are not on the atlas, is there a way to automatically delete all the viewable sprites (ones without the red border)?

(+1)

Not for the moment but I take note about it, I can add it in a future but unfortunately not for next release.

Actually most of the functionality of this tool is directly available in raylib. You can use raylib.

(2 edits)

Do you have a src-code for this program?

I'm afraid this software is closed  source. Why do you need it?

I will answer for them. Because by reusing the code of this editor, you can create a level editor that will be more convenient than the ugly Tiled.

You can check the code of rFXGen, rGuiStyler, rGuiIcons and rIconPacker, they are open source and all my tools use the same base template so the code structure is almost the same. rTexPacker just has specific code to package sprites but that's a few lines of code because it uses stb_rect_pack library.

This is rather impolite to the creator of Tiled.

this os not for mac

Nope, unfortunately I never had a mac to learn how it works and create software for it...

ok sir

Any plans to make this available as a Linux binary?

(+1)

I'm publishing a new version soon, I'll try to provide a Linux version by then.