fatalwin
fatalwin

Reputation: 45

In Xna, how do i reduce the size of my textures?

i have a 2d top-down game in Xna that uses a single image as it's 'arena'. The image is uses as a Texture2D, 4096*1050, and only 186kb as a png(the graphic is just a plain placeholder for now). When built, the xnb file is 24 mb. So, the question is, is there any way to significantly reduce the texture size?

Thanks in advance

Upvotes: 2

Views: 2301

Answers (3)

user155407
user155407

Reputation:

Consider selecting your PNG in your content project, expand Content Processor, and under Texture Format, choose "DxtCompressed". This will compile your XNB with DXT compression which reduces size considerably. However, it does reduce quality somewhat. Test it out and see what you think.

Upvotes: 2

Blau
Blau

Reputation: 5762

In debug mode texture xnb is uncompressed.

In release mode the xnb are compressed.

You should not have problems in release mode.

;)

Upvotes: 0

Cole Campbell
Cole Campbell

Reputation: 4857

The XNB file produced by the content pipeline contains decompressed image data, so its size is going to be a simple function of the texture's dimensions and bit depth. If you want the file sizes to be smaller, then either use smaller textures (that is to say, fewer pixels; whether you have 1 texture or 100 is irrelevant if they collectively contain the same number of pixels) or use a texture format that stores less data per pixel. You should be able to change the "Texture Format" option (under the content processor) for each texture to adjust its bit depth.

I would question whether this is really necessary, however. As pointed out in comments, this really shouldn't be that big of a deal, especially if the asset in question is your game's playing field. Is this a phone game?

Upvotes: 2

Related Questions