1
\$\begingroup\$

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

\$\endgroup\$
  • 1
    \$\begingroup\$ why don't you use xna standard convertor/compiler? \$\endgroup\$ – Ali1S232 Jun 5 '11 at 19:58
7
\$\begingroup\$

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.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ +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. \$\endgroup\$ – dennmat Apr 18 '12 at 17:37
0
\$\begingroup\$

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.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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