If you are only trying to get the original size of the unstripped image, you can already get that with atlasSprite.getWidth()
and atlasSprite.getHeight()
as long as you haven't yet called setWidth()
, setHeight()
, setSize()
, or setBounds()
on it.
But to create a sprite that actually has and draws that white space is not really possible, because the trimming occurs when the texture is packed. That white space does not exist in the image file or the Texture because there are neighboring regions packed closely together. (Though I suppose you could draw the sprite onto a Pixmap, leaving white space around it, and load that in a Texture, and then create a Sprite from that, but this is convoluted.)
If you want to keep the white space, you must keep it when packing the texture atlas. You can set the stripWhitespaceX
and stripWhitespaceY
parameters to false when packing.