Previously I was using simple Texture for sprite based animations, but that did not provide support for images which were not in the power of 2. TexturePacker provides with the ability to load all the images at once, and then fetch the required image from an imageatlas.

That said, I followed a couple of tutorials from the Libgdx wiki and it works well till the loading part. But I suppose during rendering, it is causing some problem. This is how I am loading the images into the texturepacker in my desktop project:

private static final String INPUT_DIR = "../Drop-Android/assets/images";
    private static final String OUTPUT_DIR = "../Drop-Android/assets/image-atlases";
    private static final String PACK_FILE = "pages-info";
    public static void main(String[] args){
        LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
        cfg.title = "Drop";
        cfg.width = 800;
        cfg.height = 480;

        Settings settings = new Settings();
        settings.maxWidth = 512;
        settings.maxHeight = 512;
        TexturePacker2.process(settings, INPUT_DIR, OUTPUT_DIR, PACK_FILE);
        new LwjglApplication(new Drop(), cfg);

Question: Do I have to create pages-info i.e. the PACK_FILE manually in the images-atlases folder? If I do not, it throws File not found exception.

I happen to create pages-info file in the image-atlases folder and the following files are generated: pages-info.png and 'pages-info.atlas'. While, pages-info files is empty, the .png and .atlas files have the images and JSON image data, respectively.

This is what I am using to extract the textureregions out of the pages-info file (which is empty):

TextureAtlas ta = new TextureAtlas(Gdx.files.internal("image-atlases/pages-info"));
        imageOneRegion = ta.findRegion("image1.png");
        imageTwoRegion = ta.findRegion("image2.png");

As expected, it returns a nullpointerexception when drawing the textureregion. I am running out of ideas here, any help and ideas?

  • 1
    \$\begingroup\$ unless you named your image( also the region name ) image.png.png it you omit the extention. \$\endgroup\$
    – Sidar
    Jun 18, 2013 at 17:24

1 Answer 1


The textures are named as in the .pack file, without extensions. Try using "image1" instead of "image1.png".

If you watch your ta variable using the debug tool you should be able to see the names of textures actually loaded.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .