Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I converted my project's .xnb files to .png files using a program and I can't seem to find a way to transform .png back to .xnb. I don't want to lose the work I've done. How can I change the images back?

P.S. GXView shows an error when I try to save as .xnb

share|improve this question
why don't you use xna standard convertor/compiler? – Ali.S Jun 5 '11 at 19:58

You can convert PNGS to XNBs by adding them to your content project in your XNA solution. You do this by right-clicking on the content project in the project explorer (right side) in Visual Studio and choosing Add->Existing. Now each time you build the solution (F5) the XNB files are created.

As far as I know you can not (easily) manually create XNB files from PNGs (or other assets) because XNB files are associated with a specific game, XNB files are a sort of protected/compressed archive for a series of assets and thus can contain more than 1 file.

About GXView, I don't know that program, but if you think that software could help you, but gives an error, could you post the error message, maybe we can help you out.

share|improve this answer
+1 @Alex: I'm not sure what the format specifications are for XNB but essentially if it is an archive or contains any extra metadata the answer is unfortunately no as PNGs will not have these and therefore that data will be lost. – dennmat Apr 18 '12 at 17:37

Not sure exactly what you are trying to do here. Are you modding an XNA based game such as Terraria? Anyways check XNA 4.0 Content Compiler.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.