Slashdot Mirror


Implementating Transparent PNGs in IE7

Brandon writes "Over at the official IE Blog, Sam Fortiner has posted some very detailed information regarding Alpha PNG Rendering in IE7. From the article: 'As the dev who implemented the support, I can state that it was neither a bug-fix nor did it require a re-write of the display engine. Instead, it ended up being somewhere in-between the two and required what I would call "feature work." Implementing transparency support for PNG images required a significant amount of modification to the image decoding and display pipeline in IE along with a significant amount of new functionality added to the PNG decoder.'"

64 of 97 comments (clear)

  1. libpng.... by __david__ · · Score: 4, Interesting

    So this implies they wrote their own PNG reading routines instead of using libpng?

    Is this some sort of NIH thing?

    libpng has a BSDish licence if I recall... So that can't be the issue...

    -David

    1. Re:libpng.... by FidelCatsro · · Score: 1

      Microsoft "Reinventing the Wheel ".

      .. .. would be a better slogan than "It just works"

      --
      The only things certain in war are Propaganda and Death. You can never be sure which is which though
    2. Re:libpng.... by Chris_Jefferson · · Score: 4, Informative

      If you read the article, you'd find the main problem is that all their internal data structures and rendering system were only designed for boolean transparency.

      libpng wouldn't have helped with either of these, and this is where most of the work was.

      --
      Combination - fun iPhone puzzling
    3. Re:libpng.... by Conan32 · · Score: 1

      So this implies they wrote their own PNG reading routines instead of using libpng?

      No. I could not find the slashdot post anymore but I remember that libpng was found in the source leak of windows 2000 / IE6.

    4. Re:libpng.... by Quarters · · Score: 2, Insightful
      When Microsoft puts BSD licensed TCP/IP code in an OS people use it as a cheap opportunity to sound psuedo-intellectual by bringing it up in vague "Microsoft is bad because they didn't write their own" terms whenever possible.

      Now those same people want to say "Microsoft is bad because they didn't use BSD licensed PNG code."

      The hypocrisy is staggering.

    5. Re:libpng.... by eraserewind · · Score: 2, Insightful

      Um, it's only hypocracy if the same person says it.

    6. Re:libpng.... by NanoGator · · Score: 1

      "Um, it's only hypocracy if the same person says it."

      Hypocracy or not, it's still a double standard.

      --
      "Derp de derp."
    7. Re:libpng.... by bedessen · · Score: 1

      *sigh* Not this again.

      MS used BSD code in their TCP/IP stack in NT 3.5 and prior. They rewrote everything from scratch for NT 4 and on. They still use some BSD code for the userland utils (telnet, ping, etc) but there is absolutely none of it in the kernel/protocol stack, and hasn't been for at least 10 years.

    8. Re:libpng.... by cortana · · Score: 1

      Newsflash: people on Slashdot have different opinions! If more people understood this then the signal:noise ratio would be a lot higher around here...

    9. Re:libpng.... by NanoGator · · Score: 1

      "Newsflash: people on Slashdot have different opinions!"

      I wouldn't be complaining if I had faith that a lot of the opinions were independently arrived at instead of showing off for mod points.

      --
      "Derp de derp."
  2. Probably because IE displays images as they load.. by cwensley · · Score: 3, Interesting

    I'd imagine this would be why IE can show images as they download, instead of waiting for the whole thing to download like other browsers...

    I could be wrong..

  3. Monopoly by augustz · · Score: 4, Insightful

    This is a really interesting case study in monopoly behavior and the value of competition. Microsoft you will remember pretty much stopped IE development and shut down the IE team.

    Firefox came along, and whamo, all of a sudden Microsoft has developers writing things like. Very impressive. What's interesting for me is they are huge huge company by comparision to Firefox, but it took firefox to really get them to start making some improvements.

  4. You are by leonbrooks · · Score: 4, Informative

    Konqueror displays partial images as they download. The original friggin' browser in OS/2 did the same thing. It's hardly new.

    Think about it: what's the whole purpose in Progressive-mode JPEGs?

    --
    Got time? Spend some of it coding or testing
    1. Re:You are by cwensley · · Score: 1

      Really? I use konqueror about 95% of my browsing time (other 5% is at work in windows) and I never noticed it. Going to a page with a really large image doesn't show anything until it's fully loaded for me.. *shrug*

    2. Re:You are by cwensley · · Score: 1

      Hm, just tried firefox and it does load (pngs) as it is downloading. An interesting question would be if the mozilla engine uses libpng, or a custom decoder..

    3. Re:You are by Anonymous Coward · · Score: 1, Interesting

      It uses libpng, just look at the shared libraries it is linked against.

    4. Re:You are by Anonymous Coward · · Score: 1, Informative

      Settings > Configure Konqueror

      In the "Web Behavior" section, check the box for "Draw frame around not completely loaded images."

      (This works for Konqueror 3.4--not sure about earlier versions)

    5. Re:You are by cortana · · Score: 1

      $ pmap $(pgrep firefox-bin) | grep png
      40736000 144K r-x-- /libpng12.so.0.1.2.8
      4075a000 4K rw--- /libpng12.so.0.1.2.8

  5. Implementating? by Atrax · · Score: 3, Funny

    put your spellchecker on danger money, baby.

    --
    Screw you all! I'm off to the pub
    1. Re:Implementating? by abulafia · · Score: 2, Funny

      Naw, they're just misoverestimavating the submittzors.

      --
      I forget what 8 was for.
    2. Re:Implementating? by Stephen+Williams · · Score: 2, Funny

      What's the problem? It's a perfectly cromulent word.

      </obsimpsons>

      -Stephen

    3. Re:Implementating? by oSand · · Score: 1

      Who cares? I think it is good that the president is taking an interest in tech stuff.

    4. Re:Implementating? by NanoGator · · Score: 2, Funny

      "I think it's time I spent my precious picoseconds looking at some other website."

      If typos are such a sore spot with you, why come down into the forum area of Slashdot?

      --
      "Derp de derp."
    5. Re:Implementating? by Random832 · · Score: 1

      how about you go ask on alt.usage.english the difference between an emerging new usage and simply making shit up

      --
      We've secretly replaced Slashdot with new Folgers Crystals - let's see if it notices.
  6. Reading between the lines of the story... by leonbrooks · · Score: 3, Informative

    ...the code they're rewriting has not been substantially changed since the days when GIF was king of the images.

    AFAICT, what they've finally added is genuine translucency (not the simple yes/no transparency of yore) to MSIE's image handlng.

    Does anyone know of any other (non-text-mode) web browser which hasn't already been doing translucency for years?

    --
    Got time? Spend some of it coding or testing
    1. Re:Reading between the lines of the story... by jericho4.0 · · Score: 2, Insightful
      "Obviously, if it wasn't a 'deep' problem, tney would have supported transparent PNGs years ago."

      The PNG support seems to have been done by one guy, in a few months. Not exactly a 'deep' problem for a company with Microsofts resources.

      I think the reason they didn't support it years ago is because they simply don't care.

      --
      "A language that doesn't affect the way you think about programming, is not worth knowing" - Alan Perlis
    2. Re:Reading between the lines of the story... by Thundertje · · Score: 1

      Win2k had and has translucency support. That's almost 5 years ago now.

    3. Re:Reading between the lines of the story... by bedessen · · Score: 1

      Um, IE has always had 8 bit translucency support. It's done through a directx filter. You can enable this with javascript so that IE treats PNG transparency correctly, and this has been known for years - IE 5.5 and up. One of the links in TFA documents this method. http://homepage.ntlworld.com/bobosola/pnghowto.htm

      If you look at the source to, say, google maps, you will see that they use this very method to make the drop-shadows work properly with IE.

  7. Implementating? by eric.t.f.bat · · Score: 3, Informative

    Implementating? Implementating???!!!

    Something is very very wrong with the /. editors. I think it's time I spent my precious picoseconds looking at some other website.

    --
    I have discovered a truly remarkable .sig block which this margin is too small to conta
  8. about time... by Gollum2001 · · Score: 1

    "Implementing transparency support for PNG images required a significant amount of modification to the image decoding and display pipeline in IE along with a significant amount of new functionality added to the PNG decoder."

    also known as...

    "we fixed the fucking PNG transparency 'bug' in IE, so stop whinning and kiss our asses."

    Too late Microsoft, I switched to the Mozilla suite loooong time ago...

    --
    "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former" - Albert Einstein.
    1. Re:about time... by Gollum2001 · · Score: 1

      Well, actually Microsoft should care what people use, specially if Mozilla and Firefox are the cause of IE decline. And I use PNG for every graphic in my website AND some of them have transparent backgrounds, if you want to make them "compatible" with IE you have to tweak the PNG with TweakPNG . Take a look. Actually you can't make it transparent, but can set the background color to match the color of your background. They'll be transparent in Mozilla and color-match in IE.

      Ok? Smart-ass....

      --
      "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former" - Albert Einstein.
  9. Requires IE5, IE6 by julie-h · · Score: 3, Funny

    I have a question. When there is written

    "Requires IE5, IE6, or better"

    on a website. Does that mean Firefox?

    1. Re:Requires IE5, IE6 by FidelCatsro · · Score: 4, Funny

      to me "Best viewed in Microsoft Internet Explorer" say "Wanted , new web designer/Developer"

      --
      The only things certain in war are Propaganda and Death. You can never be sure which is which though
    2. Re:Requires IE5, IE6 by Baron_Yam · · Score: 2, Interesting

      As an extremely crappy web site maintainer (I maintain a moderately unimportant site as the last and least significant of many duties)...

      The first thing I did on taking over the job was convince my boss that I needed to install Firefox and a Tidy-based HTML validator to ensure the site had been coded correctly... it wasn't. Several things didn't work properly, and a few things here and there just didn't load at all.

      Now that I have Firefox on my PC, I use it by default, and pop up IE to check the site for IE compatibility. Firefox is just a better freakin' product, especially with my four or five fave extensions.

    3. Re:Requires IE5, IE6 by FidelCatsro · · Score: 2, Funny

      IE is a complete pain to code to , I have it installed on my Mac just for testing compatability if i ever feel like doing any web stuff.
      I end up making a php checker page sometimes to just redirect people to a striped down non complient page if they are using MSIE.
      Well thats ok for me , most of my stuff is for Unix type OS or mac so there isn't really much alternative , though i have got complaints from people whop use IE saying my site is broken , the reply is awlawys (if they are using MSIE) "No your browser is", Simple as that... though most people dont really have an option like that.
      The only awnser has been to code in some javascript check to alter parts of the page based on the browser . ;) When i was working as a web dev , there were days when i felt like taking a flight to the MS offices and going "Standards complient " on the IE team.

      --
      The only things certain in war are Propaganda and Death. You can never be sure which is which though
  10. Fixes by Adelbert · · Score: 3, Funny

    So IE7 will show transparent PNGs, Firefox 2.0 will render /. properly. What will I be able to complain about then?

    1. Re:Fixes by terrox · · Score: 1

      How about someone either fixes slashdot or fixes Firefox ? I would, if I could! This means I can not hide anti-ie messages in my PNGs anymore, they will have to be version specific now :-/

    2. Re:Fixes by shadowzero313 · · Score: 1

      Firefox 2.0 will render /. properly. I haven't been hit with the render bug since the upgrade to 1.0.2, actually. On both windows and linux versions of firefox, too. I'd say it is fixed from that. But if it isn't, I've just cursed myself to be hit by it.

    3. Re:Fixes by bedessen · · Score: 1

      You can work around the firefox bug (it's not slashdot's fault) with an extension: http://hardgrok.org/blog/item/slashfix-firefox-ext ension.html

  11. CSS support? by tryone · · Score: 5, Insightful

    Very nice. Now go fix the crappy CSS support.

    1. Re:CSS support? by kingkade · · Score: 1

      IE CSS support has some issues but i've found that it sometimes behaves better than Gecko's. An example is:

      <table style="display: inline; border: 1px blue dotted; "><tr><td style="border: 1px green solid;">td1 and</td><td>td2 here</td></tr></table>

      You'll see the table cell borders go beyond the table itself. Not too intuative.

      Also, there seems to be trouble with a a font and size being inherited from a table to it's cells; different from IE, but not sure if this is supposed to be correct.

    2. Re:CSS support? by Nevyn · · Score: 2, Informative

      You need to specify "display: inline-table;" for the table element.

      --
      ustr: Managed string API with ave. 44% overhead over strdup(), for 0-20B
    3. Re:CSS support? by Enrico+Pulatzo · · Score: 2, Insightful

      Are you trying to break CSS with your markup there, or do you have a legitimate reason for making a table display inline? When you make an element inline and force it to contain non-inline children this kind of thing happens. It'd be the same as wrapping a table with a span and complaining that the span isn't being applied correctly.

    4. Re:CSS support? by kingkade · · Score: 1

      You're right, thanks. Actually according to this inline-table is a CSS2 feature, but it's noteworthy to mention that inline-block works just as well.

  12. Png, schming by the+eric+conspiracy · · Score: 2, Insightful

    Now that the LZW patent has exprired, whoop-de-doo. Where were they when we really needed good png support?

    What we need now is something that isn't a petri dish full of a rich agar browth waiting for every sort of web infection to take root and mulitply to the destruction of your computer, and something that adheres to CSS2 standards. But we already know that these needs aren't going to be met, so all I can draw as a conclusion is IE7? Bugger off. Waste of Time. Non-starter. Count on using Firefox for the foreseeable future.

    1. Re:Png, schming by the+eric+conspiracy · · Score: 1

      Ah, your traps will mysteriously shut as the number of Firefox-only worms/bugs/virus/security holes increase in proportion to FF popularity! It will be DELICIOUS!

      Since Firefox now has about 10% of the browser market, shouldn't we have seen about 10% of the virial infestation (if it is proportional like you say) by now??

      Shocking that it hasn't turned out that way, wouldn't you say?

  13. Re:Probably because IE displays images as they loa by JFitzsimmons · · Score: 1

    We've been through this a million times on slashdot, the hardcoded maximum in firefox is 8. Really, IMHO, that option should be disabled - 8 hits for every one view seems somewhat wasteful of internet bandwidth on both the client and host sides.

    --
    Beware he who would deny you access to information, for in his heart he dreams himself your master. -Anonymous
  14. No, actually, it isn't. by abulafia · · Score: 1
    Now those same people want to say "Microsoft is bad because they didn't use BSD licensed PNG code."

    The hypocrisy is staggering.

    (1) please point out which, exactly, of "those same people" are doing both.

    (2) Even if that is the case, the point on the BSD stack thing is ususally that MSFT fails to fully implrement it. At least from my perspective.

    (3) "Staggering hypocrisy" is more than just a little, um, "staggeringly overstated", don't you think?

    --
    I forget what 8 was for.
  15. Pfft... by percussor · · Score: 1

    I supose we're going to have to wait till 9 for Acid2.

  16. You underestimate the power of PNG by Anonymous Coward · · Score: 2, Informative

    Besides the fact it generally offers better compression, now that we have FULL transparency in IE7, we can start doing some really great things with overlaying images in styles and such. Too bad it'll be like 2012 before IE6 disappears.

  17. Re:Probably because IE displays images as they loa by mbogosian · · Score: 1

    I'd imagine this would be why IE can show images as they download, instead of waiting for the whole thing to download like other browsers...

    Probably not. Many formats support interlacing (or progressively higher quality data with formats like JPEG). This basically means that the same (or similar) data is present, but in a different (predictable) order allowing useful images to be displayed without having access to the entire image file. IIRC, even early versions of Netscape supported this. I know may graphics viewers from the dialup BBS days did the same thing.

    PNG has interlace support as well.

  18. acid2? by cei · · Score: 1

    So the safari guy writes code that passes the acid2 test last week and now this post. Makes you wonder if someone at Microsoft heard that and said, "Anybody here working on this thing?"

    --
    This sig intentionally left justified.
  19. Stop complaining!!! by fok · · Score: 1

    And thank Sam Fortiner for the work done! Can't you see there is a group of people trying to make a better broeser out of IE? Are you blinded by your own arrogance?

    --
    \m/
    1. Re:Stop complaining!!! by percussor · · Score: 1

      How about just not making it at all. FF obviously has replaced anything of value in IE.

    2. Re:Stop complaining!!! by AdamWeeden · · Score: 1

      Let me preface my comment by saying I use FF and not IE. I think this sort of thinking is ludicrous. Let us pretend that FF is superior to IE in every way. Wouldn't this mean that IE should work hard to surpass FF? If everybody stopped developing because there was a "better" product out there, there would be no innovation. FF is not perfect, and never will be, therefore I encourage the devs at MS to make IE as good as they can to compete.

      --
      I was quoted out of context in my autobiography...
  20. Re:IE does support translucent PNG's... by fok · · Score: 1

    This is a hack to render transparent pngs into a gif image using IE's filters. It's slow and only works with IMG tags. But works.

    --
    \m/
  21. A workaround for some cases by BandwidthHog · · Score: 1

    This bit of javascript will enable 8-bit alpha for PNGs used in IMG tags. Won't work for PNGs used as backgrounds of objects, but is at least moderately useful, considering that even if they release the fixed version of MSIE today, older versions will persist in large numbers for many years.

    --

    Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?
  22. Cool. by abulafia · · Score: 1

    As someone that studied language, semiotics, and the philosophy of language, I can say you have opened up an entirely gnu whorled for we. Futhermore, sinctification flails to indegnify the snotastic iconiflications your mesmerificate. I/We chan lonley hop seiden froden not only antideifyen, however, siche misunderestimation leaves problemification many wierdefied.

    --
    I forget what 8 was for.
    1. Re:Cool. by abulafia · · Score: 1
      siche misunderestimation

      Sorry screwed up. I should have said, "siche misuderestimataton."

      I return you to your regularly scheduduled manglish classicalish studification.

      --
      I forget what 8 was for.
  23. I wonder... by Short+Circuit · · Score: 1

    ...if boolean transparency data structures contributed to their not using anti-aliased fonts.

  24. compete!? HA! by Xtifr · · Score: 1

    I encourage the devs at MS to make IE as good as they can to compete.

    Oh, you want them to compete!? Then I think the first thing they're going to have to do is take IE out of the core OS, publish the API that a browser needs to provide in order to be the core OS's browser, and allow vendors to distribute the OS with any browser that matches the API. I.e., e.g., no more requirement for IE for their Update services.

    Until they do that (at a minimum), what they're doing is not properly described as "competing". It's properly described as leveraging their monopoly.

    That said, I do agree that improving IE is not necessarily a bad thing. It depends on whether they're doing it to make the browser more attractive and useful on its own terms, or whether they're doing it in order to lock more people into their proprietary "variants" of actual standards. And this case (considered on its own) does indeed seem like it might be a rare instance of the former, which is a good thing. But IE considered as a whole still constitutes an attempt to lock in customers, lock out competition, and embrace, extend and extinguish open standards.

  25. [OT] I just want to know why... by leonbrooks · · Score: 3, Funny

    ...when Conan32 spelt "hypocrisy" correctly, and both eraserewind and NanoGator had it right there on their screens to reply to, they both spelt it wrong?

    <thwack!>

    --
    Got time? Spend some of it coding or testing
  26. You mean... they don't LOVE me after all? by leonbrooks · · Score: 1

    They only wanted me for the licence fee! I feel so used...

    --
    Got time? Spend some of it coding or testing
  27. It's not quite that simple by leonbrooks · · Score: 1

    If dickwhackers are writing malware for one browser, it will be the most popular browser. Only when we see IE and FF approach neck-and-necking it at about 45% each will they start trying to target FF in anger.

    By then, of course, most of the remaining ugly corners will have been filed off the FF code by the current exposure to the odd angry nut, and it will never ever have many of IE's design defects anyway, so while the number of actual exploits may go up, I can't see FF ever rivalling IE in sheer destructiveness.

    --
    Got time? Spend some of it coding or testing