Skip to main content

Microsoft Silverlight

Answered Question XAML vs pngRSS Feed

(0)

caperaven
caperaven

Member

Member

133 points

107 Posts

XAML vs png

We are planning a system rewrite into silverlight.

At this point we need to decide if we are going to use png or xaml as our icon format.
xaml scales nice in size with no quality loss, but icons don't scale all that much.
It seems that png files you can grow in silverlight and the quality is still not tooo bad.

From a size perspective the same icon created in expression design, the xaml is 4k and the png 0.5k in size.
Since size does matter in web applications, the question is, what is the suggested image format to go for when it comes down to icons.
I also know that the xaml will compress in an assembly and that png does not compress all that well.

Was hoping some of you might have insight or experiance in what format to opt for.

party42
party42

Participant

Participant

1102 points

338 Posts

Re: XAML vs png

Basically you're giving the answer yourself. Use XAML for vector graphics which need scaling. Otherwise, you're perfectly fine to use PNG (make sure you set it to 96DPI). 

Regards,
Nathan Brouwer

http://www.nathanbrouwer.nl

Yi-Lun Luo - MSFT
Yi-Lun L...

All-Star

All-Star

25052 points

2,747 Posts

Answered Question

Re: XAML vs png

Hello,

Advantages of vector graphics:

  • Scaling without quality loss.
  • For large images (for example, 800*600), the file size is generally smaller than bitmaps.
  • Easy to be animated. You can easily change a color, a point, etc, during an animation. Most times no manual code is needed. For bitmaps, you have to write some code to change images, and the result is not very smooth.
  • Better performance.

Disadvantages of vector graphics:

  • For small images (for example, 20*20), the file size is generally larger than bitmaps.
  • May be difficult to use in a ContentControl, such as a Button. For bitmaps, you can just use a Image Control as the Content, but for vectors, you have to copy the XAML. If you want to reuse the vector image, you have to create a UserControl.

So if your icons are static, I think it's better to use png.

shanaolanxing - I'll transfer to the Windows Azure team, and will have limited time to participate in the Silverlight forum. Apologize if I don't answer your questions in time.

SpaceManPlusPlus
SpaceMan...

Member

Member

12 points

18 Posts

Re: XAML vs png

It depends, if you are making a complex one, use PNG

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities