Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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 am new to XNA programming and I loaded the background image using ContentManager as a Texture2D object.

The background image which I have is of size 480*320. I have kept the minimum game window size as 640*480. My question is how would i resize the background image to the size of the game window.

Thanks in advance!

share|improve this question
up vote 4 down vote accepted

Whatever size the destination rectangle is for any of the top 3 SpriteBatch.Draw functions is how large your image will appear on screen.

So try the below to automatically draw an image full screen.

SpriteBatch.Draw(background_texture, GraphicsDevice.Viewport.Bounds, Color.White);

Note this doesn't actually change the size of you image it just scales it to the specified size when rendered.

share|improve this answer
Wow that was a simple thing to do. Thanks a lot :) – Gamer Mar 8 '12 at 19:11
Welcome to the wonderful world of XNA :) – ClassicThunder Mar 8 '12 at 19:14

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.