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'm currently writing a program in C# with the XNA framework. It is absolutely necessary for the game's images and text assets to be visible by the end user in the form of PNG files, so I can't use the content pipeline.

How would I go about using graphics and text in my XNA game without it?

share|improve this question

You don't need the content pipeline.

MonoGame, for example, allows you to use LoadContent<Texture2D> and specify an image name of a file that's just a simple PNG in your Content directory. This is what I do for all my projects (since MonoGame has difficult/flakey? support of the content pipeline today), and because I don't care about "protecting" my assets by converting them into XN* format.

From what I remember of "vanilla" or MS XNA, this worked there too.

share|improve this answer
Note that you don't need to store the raw PNG and other content in the Content directory, and that textures that you load in this fashion do not have pre-multiplied alphas, so this will need to be done manually. See my answer here for a method that does this. – John McDonald Jan 21 '13 at 22:57
@JohnMcDonald I'm not sure if this is true. I have no problem with pre-multiplied alphas, albeit you have to set the spritebatch BlendState to Non-Premultiplied. See my question here:… – ashes999 Jan 22 '13 at 0:54
Makes sense, either multiply the alphas yourself, or tell XNA that the alphas haven't been pre-multiplied. – John McDonald Jan 22 '13 at 16:31

Use Texture.FromStream to load the texture at runtime. This is a little tricky because of premultiplied alpha as referred to in ashes999 answer. Here is a great explanation from David Gouveia on how to do it correctly

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.