Take the 2-minute tour ×
Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. It's 100% free, no registration required.

When exporting / saving images with a transparent background that are intended for websites, should I save it as PNG or SVG? Why?

share|improve this question
1  
Related: What web graphics formats to use? –  JohnB Nov 3 at 14:46

7 Answers 7

up vote 9 down vote accepted

I would say PNG simply for the fact it seems to be a more accepted format than SVG.

share|improve this answer
3  
For quality SVG it is better, but in practice the only real solution is PNG because SVG it is not globally supported at this current date. –  Littlemad Jan 6 '11 at 17:57
    
@Littlemad Rendering and displaying SVG is also slower than simply blitting the image with a PNG. –  muntoo Jan 7 '11 at 5:52
    
@muntoo Well, the image is not just blitted. It has to be decompressed, but that's almost always faster than rendering an SVG. –  Camilo Martin Jan 14 '12 at 9:39
    
@Littlemad Ha, that reminded me the same problem was raised before... With PNG and GIF. –  Camilo Martin Jan 14 '12 at 9:40
    
@CamiloMartin cannot wait that browser had good support for technologies much more quicker than normal. I want to use SVG, I feel frustrated in rely on a not-scalable png for logos –  Littlemad Jan 16 '12 at 11:13

SVG is scalable, if you have a vector-graphic that is a clear advantage. For pixel-graphics PNG is better. A downside is, that the Internet Explorer supports SVG only with the coming version 9 (before with plugin). Mobile browsers may also have limited support for SVG.

EDIT: As ClemDesm points out, older IE-versions don't support fully transparent PNG, since IE8 that is supported. Non-transparent PNGs work fine. The answer of Computerish has a great solution for handling vector images for now: Keep them as SVG, but export them for web as PNG. I fully agree with this solution.

share|improve this answer
    
-1 Svg it is still not globally supported I wouldn't suggest the use if you don't explain clearly where is working and a fall back alternative in the case it is not working (most likely). We have to consider the web standards that we are trying to achieve. If the choice is for web and it is for PNG or SVG, it should be always PNG, until SVG it is globally supported by browsers of one generation older. I would love to use SVG perfection, but it is not yet a reality. –  Littlemad Jan 6 '11 at 17:55
    
As I wrote, IE has no SVG-support (only in the until now future version 9) and mobile browser may lack support too. –  Mnementh Jan 6 '11 at 19:41
    
@Littlemad : the downvote is a little exagerated since 1- the answer tells us it's not fully supported (ok, not so much details but, yet, it's told and not wrong, doesn't deserve a -1) 2- PNG alpha channel isn't supported in IE6 & 7 either and not a word about that ? :) –  Shikiryu Jan 7 '11 at 9:10
    
@ClemDesm: Ah, good hint, older IEs don't support transparent PNGs fully. –  Mnementh Jan 7 '11 at 10:32
1  
@Littlemad "is not supported in many recent browsers" That seems to be a wrong conclusion, since in the linked reference, there is only one browser, which isn't capable of handling SVG (IE8). You also don't need to install plugins to use SVG (never saw that, maybe in IE6). What you see in red on the linked reference are parts of SVG, you mostly wont use (mostly some kind of filters or other effects). The basics works. –  feeela Jul 18 '11 at 15:07

Definitely use PNG for a website. SVG is simply not sufficiently widely supported and it has few (if any) significant benefits over PNG for a flattened export. That said, keep all of your working copies in SVG.

share|improve this answer
1  
Good solution to keep the original as SVG and export it to PNG for web. If SVG is later better supported you can change it. I would recommend that solution for vector images. –  Mnementh Jan 7 '11 at 10:32
    
"it has few (if any) significant benefits over PNG" What? How do you manipulate PNG's via CSS or JavaScript? How do you scale them, without loosing resolution? How do you link parts of an image (e.g. a country-link on a map)? SVG-files commonly also much smaller then PNG (except for tiny icons). –  feeela Jul 18 '11 at 15:03
2  
SVG has lots of advantages over PNG for vector illustrations. –  DA01 Jul 19 '11 at 23:15

The simple answer here is use both.

The fact that you've named SVG as an option, means we can rule out photo graphics as an intended use case - because SVGs are only good for line-art graphics such as logos, icons and clip-art-like illustrations.

If you are considering this choice for photo graphics, there is no choice; PNG will probably always be better. For graphics where SVG is a viable option, SVG is the best option with a PNG/JPEG fallback. PNG has many strengths, but on scalability and file size, it will often not match up to SVG.

Using only one or the other means you will have to sacrifice either backwards or forwards compatibility.

Weighing them against each other, PNG certainly will be supported by more browsers than SVG at this current point in time, but the resolutions of newly released devices are forever increasing, meaning PNGs will either need to be served based on a wide variety of different resolutions (via Media Queries, JavaScript or User Agent Sniffing) or scaled by the browsers, which could produce some imperfect results.

Looking at what we know the future holds; forever higher resolutions, wider support and wider use of SVGs across the internet; it makes sense to build for what's coming.

In general, websites should be built to last for many years; in 5 years time your beautifully backwards compatible website might look amazing for the 2% of internet users still using old browsers, yet fairly poor on the up to date browsers with crazy resolutions - so it's very much a stack of hard choices on which way to compromise.


Your options in November 2014

  1. PNGs only

    • For the sake of quality you'll need to serve at least five different versions depending on screen sizes and resolutions - and that's a very conservative guesstimate, you could end up with 10 - 15 versions of the same image if you wanted to be extremely thorough. This also takes some time to implement.

    • If you chose to serve a single graphic and have the browser scale it, the results will probably be less than perfect, and could even be ugly depending on the amount of scaling.

    • A large number of media queries could unnecessarily bloat the CSS and negatively impact on page loading speeds.

    • Will look great on older browsers and devices, but not so great on newer ones.

  2. SVGs with single PNG/JPEG/GIF fallback

    • You could use SVGs everywhere and then have it fallback to another format for browsers that don't support SVG. The main advantage is you only need one file for all the different resolutions.

    • If you compromise and accept that users on outdated browsers can live with imperfectly scaled graphics, you would only need one other version of each file in PNG, JPEG or GIF format.

    • This would take a similar amount of time to implement as the PNG only media queries - possibly even less, meaning it would probably be around the same price.

    • Will look great on all new devices, with sacrifices being made on older technology.

  3. SVG with multiple PNG/JPEG/GIF fallbacks dependant on resolution and screen size

    • You could serve SVG first, and then resolution-dependant PNGs for browsers that don't support SVG. This would be the most thorough, most backwards and forwards compatible, most consistent and most expensive time-consuming option.

    • It would probably take as much time as 1 & 2 combined, plus a little extra for working out the kinks.

    • Will look amazing on almost every device.


In summary, I think it depends on whether you're looking for more backward compatibility or more forward compatibility, and how much money time you have to spend.

share|improve this answer
    
You might mention something about the <picture> element helping out with various image sizes –  Zach Saucier Nov 3 at 16:45
    
@ZachSaucier that is awesome! First time I've heard of it, thank you. When I've researched a little more I'll add something, though there is a lot of info. –  DumbNic Nov 3 at 17:55

I would stick with PNG to be on the safe side. SVG is still not fully accepted by many big internet companies & browsers. Although SVGs are scalable and are vectors they are often unnecessary, take up more space and overcomplicated the website.

I hope that answered your question :)

share|improve this answer
    
"take up more space and overcomplicate"? How so? –  DA01 Oct 30 at 20:23
1  
I'm pretty sure it may impact your SEO as your images may not show up on Google and I'm not 100% sure but it's often the case that SVGs take longer to load –  coconido Oct 30 at 21:10
2  
Time to load is based on file size, of which SVGs can often be much smaller. And if google image search is important for your sites' SEO, yes, PNG might be better, but I think that's more of a niche thing. –  DA01 Oct 30 at 21:16
1  
Yeah, I mean at the end of the day there is no right or wrong answer. The file size much depends on the complexity of your image & yes your choice depends on the use case. I was merely stating the pros and cons of the different file types :) –  coconido Oct 30 at 22:24

Even though SVG isn't globally accepted and some people have a frustrating time scaling PNGs, I have always found that creating an icon within Adobe Illustrator works best at scaling up or down a "reasonable" amount.

share|improve this answer
    
Hi stancil21, welcome to GDSE and thanks for your answer. If you have any questions, please see the help center or ping one of us in chat once your reputation is sufficient (20). Keep contributing and enjoy the site! –  Vincent Oct 15 at 13:00
    
Does Adobe Illustrator allows pngs or svg or both or what exact is the reason to name Illustrator here? And why do you think svg isn't globaly accepted? –  Kurt Oct 15 at 14:46

in my view SVG is best than PNG use HTML 5 SVG codes to insert these SVG in your page

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

protected by Matt Oct 15 at 13:28

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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