Compartilhar via


WP7 Perf Tip #6: Be smart about graphics (use JPEG where possible)

Take Away's:

  1. Wherever possible (i.e. no transparency) use JPEG images since these decode faster than PNG
  2. Make sure your images are correctly sized (you don't want to waste cycles with resizing on the fly)
  3. Always compile your images with a "Build Action" of "Content" instead of the default "Resource"

Some Background:

  1. JPEG (JPG) decodes faster, simple as that. The difference will continue to shrink over time, but every cycle is important on the phone, especially on image intensive applications.

    Don't take this to mean "never use PNG", rather, PNG is slower so only use it when you need it (transparency) as opposed to for everything as a generic default. 

  2. Although resizing is quick (even if it looks ugly) there is no point wasting those cycles resizing images on the fly (Silverlight will do this for you) if you can already size the images correctly from the start

  3. The default when adding new images is to set "Build Action" to "Resource" (under the Properties window). Make sure to always change this to "Content" in order to reduce the size of your DLL, speeding up both app load and image load.


    The properties window, with the correct "Build Action" set