Slashdot Mirror


New HTML Picture Element To Make Future Web Faster

nerdyalien writes: At some point, haven't all web developers spent an unjustifiable number of hours trying to optimize a desktop site for mobile devices? Responsive web design provides a solution: "develop once, works in every device." However, still it downloads multi-MB images and re-sizes them based on device screen resolution. Retrieving optimized images from the server, based on device (desktop, tablet, phone) and the device's internet connection (fiber, broadband, mobile), has always been an open problem. Recently, a number of freelance developers are tackling this with a new HTML element, <picture>, which informs the web browser to download optimized images from the server. The tag will be featured in Chrome and Firefox later this year. Will this finally deliver us faster web browsing on mobile devices and an easier web development experience?

24 of 161 comments (clear)

  1. Dupe by Hsien-Ko · · Score: 4, Interesting
  2. GUI technology has regressed since the 90s by thebeastofbaystreet · · Score: 4, Insightful

    Think about just how much work is now needed to display a simple GUI on a number of different devices. Something that a single developer could once have cooked up themselves now takes teams of designers, UX people, UI coders, back end coders and the rest to do. Really, we should chuck it all out and just start again.

    --
    my blog of work misery - http://beastofbaystreet.com
  3. Responsive Web Design by vux984 · · Score: 4, Insightful

    " Responsive web design provides a solution: "develop once, works in every device."

    Name one good responsive web design that isn't shit on at least one of desktop or mobile. (And an awful lot of them are shit on both.)

    Anything actually good just builds them separately, and lets you switch between them; and selects as default the right one based on screen size (screen not window) Nothing sucks worse than making a desktop window smaller because you just want to keep one part visible while you work with something else and having the site spontaneously implode into a mobile version -- just one of the countless forms of SUCK thanks to "responsive web design".

  4. It's the 1990s all over again. by oneiros27 · · Score: 5, Insightful

    Back in the days of HTML, they decided that it was awful that the people using dial-up had to wait so long for images to load ... so they came up with the 'lowsrc' attribute to the IMG element:

    <img lowsrc='...' src='...' ...>

    Or, you could could go with the 2000s route, and use CSS's media queries so that you don't try to push large images down to small-screen devices.

    Wouldn't it make more sense to just use a known attribute or method rather than trying to come up with yet another solution every few years?

    --
    Build it, and they will come^Hplain.
    1. Re:It's the 1990s all over again. by tepples · · Score: 2

      <img lowsrc='...' src='...' ...>

      That was never standardized, and its implementation was removed for reasons described in bug 92453.

      Or, you could could go with the 2000s route, and use CSS's media queries so that you don't try to push large images down to small-screen devices.

      Do media queries allow changing the effective src of an img element, or do they work only with background images?

  5. Kodak had the right idea decades ago by Solandri · · Score: 4, Interesting

    For this solution to work, not only do you need to implement a new HTML element and get the servers and browsers to support it, people uploading photos (or their servers) need to generate and store multiple size versions of the same pic.

    Kodak pretty much solved this problem in the 1990s with their ill-fated Photo CD format. JPEG encodes pictures in sequential 8x8 pixel blocks. So once you set the image size and encoding quality (which determines files size), everything from that point on is committed to those settings. By contrast, Photo CD encoded a low-res Base version of the picture (512x768). A double-resolution version (1024x1536) called 4 Base is then created by doubling the size of the base and storing the (compressed) delta from that and the resized original photo. The process is repeated for 16 Base (2048x3072).

    Essentially, whereas JPEG stores the picture in sequential translated blocks, Photo CD stores the picture in zoomed blocks - kinda like a fractal. If you want the low-res Base version of the picture, you only have to read the first part of the image file. If you want the med-res 4 Base version, you read further along the image file. If you want the high-res 16 Base version, you read the entire image file. (Speaking of which, there was a fractal-based compression algorithm. But the licensing fees were so onerous it never went anywhere.)

    Despite Kodak's eventual demise, they were at the forefront of digital imaging (why they held on as long as they did - they owned most of the digital photography patents). And their engineers put a lot of time and thought into the Photo CD format and future-proofing it.

    1. Re:Kodak had the right idea decades ago by StormReaver · · Score: 2

      And [Kodak's] engineers put a lot of time and thought into the Photo CD format and future-proofing it.

      And after the patent restrictions expire, this format may possibly become useful. As it is, this format is completely useless because of the patent threat.

      Software Patents: killing innovation since 1998.

  6. Let's see by armahillo · · Score: 5, Funny

    Let's see how Internet Explorer can manage to munge THIS tag up.

  7. Progressive JPEG by tepples · · Score: 2

    Progressive JPEG already does most of that. It breaks up the DCT coefficients into multiple "scans", each of which adds more detail to the image. A slowly loading progressive JPEG starts blurry (suitable for small displays) but fills in with the higher spatial frequencies as it is received. Perhaps what progressive JPEG needs in order to become a best practice for responsive images is a header to tell how big each scan is (in spatial frequency and in bytes) so that the browser can use range requests rather than having to close and reopen a connection once it's seen enough data for a particular pixel density.

    1. Re:Progressive JPEG by AuMatar · · Score: 5, Interesting

      What you'd need there is not file support, but server side support. If you're downloading a single file with all those formats, you're going to have to download everything at once. That's inefficient (important on mobile devices) and slow. Stuffing all the sizes into one container isn't the answer.

      Instead, what you'd like is one URL to automatically send you the correct file(s) for your size(s). For example, you could put headers in the http request giving the desired resolutions and the response could have each of those sizes, in preference order. Basically have each image request turn into a CGI request for multiple files. More or less what this new tag is trying to do client side. Of course doing it client side, while less convenient all around, does have privacy advantages- you can't guess the device type from the sizes requested.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    2. Re:Progressive JPEG by Em+Adespoton · · Score: 2

      you can't guess the device type from the sizes requested.

      Sure you can; the security point is that you can't KNOW the device type from the sizes requested. You have to guess.

      However, it seems to me that using element fingerprinting, this element would be a pretty strong indicator to narrow down who you were.

    3. Re:Progressive JPEG by Frnknstn · · Score: 2

      I don't think you were paying attention to how a progressive .jpg works. The file has only the full-detail image in the file, but the as you load more and more bits from the file, the quality improves from unrecognisably blurry to sharp and detailed.

      Simply request the file from byte 1, load until you get the level of detail you need, then close the connection. If you need more detail later, just resume the download.

      --
      If it's in you sig, it's in your post.
    4. Re:Progressive JPEG by Intrepid+imaginaut · · Score: 2

      Which is really uncomfortable to look at. My eyes keep trying to focus on the blurry image and can't. Also how do they propose to test client bandwidth, maybe the client is downloading an ISO or five at the same time but wants the higher res images anyway.

      Anyway @media does this already with normal image tags and can be refined to any degree of granualarity needed, and yes img srcs can be changed in CSS.

      And really the plethora of new tags making an appearance is getting weird. I came across a tag recently whose main advantage seems to be in terms of SEO, as in google will probably rate images displayed under higher in sciencey-sounding searches. No indication as to how this won't be abused by spammers just like every other meta-esque tagging scheme, of course.

  8. Designer by CanadianMacFan · · Score: 3, Informative

    Or the graphics designer could just optimize the graphics so that they are the smallest possible size in the first place. Then they are the fastest for everyone. Designers, like programmers, are usually used to having the fastest computers and connections so they forget about people with slower computers and connections.

  9. Bah by Anonymous Coward · · Score: 2

    Or, it could can just be ignored it from day one, like I did. All my pages still work fine. I never lost sight of the idea that the content was key, and that the interior-designer fascination with "GUI design" was so much ridiculous overkill.

    o Does the page work, and quickly? Yes? Fine.
    o Is the writing high quality and cover the subject at hand thoroughly? Yes? Perfect.
    o Is it image heavy? Probably want to rethink it, because you're probably just producing pablum for the tl;dr masses.
    o Does it need input? Server-side CGI then.

    HTML, CSS and CGI can easily and consistently handle 99.99% of everything. And you probably don't really need that last .01%

    And guess what? Your pages can work on everything that is even somewhat modern.

    I'll grant you that the bloody browser makers could do a better job with consistent support of CSS, but other than that one wart, it's all a doddle. IF you know what you're doing.

  10. Re:Which site "collapses"? by vux984 · · Score: 4, Insightful

    There are several, but site I was referring to in particular was mashable.com. It came up at work as an example of "good responsive design" to which I argued that it was in fact abysmal.

    These were some of my notes taken at the time (I don't know if they all still apply, but a click glance confirms at least most of them still do)

    Chunks of the site can't be reached from mobile at all - how do I get to "Jobs" or "Advertising" from a smartphone?

    And on the desktop, parts of the site can't be reached depending on the size of the browser window and we're not talking perversely small either: that "more" popup menu on the desktop starts losing sections outright at around 1100px). 1100px is too narrow! Want a job at mashable? They don't have a section for that unless your on a widescreen.

    Worse, if you shrink the page below 1000px wide, you start losing content columns off the home page too -- they're just gone. You can't scroll horizontally to get to them, and unlike the mobile version which displays one column at a time with a column selector to switch, that selector doesn't appear on the desktop. If you shrink your window, you just lose columns. No selector, no scrolling, the content is just gone.

    Additionally the column selector names are different from the desktop column headers... "What's new" is renamed "New" for space and that's fine as the translation is preserved. But "The Next Big Thing" is renamed "Rising" for space -- that's a navigation cue that got lost in translation. If I were to say, 'Look for the article under "The Next Big Thing", ' nobody is going to make that connection.

  11. Offline browsing by tepples · · Score: 2

    I agree that images for the foreground page should be prioritized. But not loading images for background tabs at all would break offline use. Consider someone who loads up on web pages to read on a laptop before boarding a bus: load tabs in the background, close the lid to put it in suspend, board the bus, open the lid, and then view the pages.

  12. Re:does this mean.... by n1ywb · · Score: 2

    Images are normally loaded even before the HTML

    I think I may have misunderstood but how the hell does a browser load images before loading the html that tells it what images to load?

    --
    -73, de n1ywb
    www.n1ywb.com
  13. Re:does this mean.... by SuricouRaven · · Score: 2

    HTML isn't just one file any more. It's often supplimented by CSS, rewritten on the fly by javascript that pulls additional content from new URLs, and quite dynamic in general. It's quite possible for a browser to start downloading images before it has the HTML fully rendered.

  14. Re:Client or Server side? by X0563511 · · Score: 2

    Sounds like a perfect use case of HTTP headers. Why would a new HTTP method be required?

    Get the headers? Great! Use them. Don't recognize them? Oh well, ignore them. Don't get them? Use sane defaults.

    --
    For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
  15. Re:Client or Server side? by TigerTime · · Score: 2

    You can't scale it on the client side, because one of the core reasons for doing this is to NOT download large images for areas were a mobile connectivity is a factor. So you can't scale it down unless you've already downloaded the large version. This wouldn't work.

    You have to ONLY download the correct size you need.

    This could be done manually with tags, which seems to be the chosen route. However I think what "bobbied" suggested above would be a good automated way of doing it. Say you set up a meta tag using the media queries in the HTML to be "mobile conscious". Then anytime it ran across an , the browser would request images as such: "GET image.jpg?max-width=18em" (or however else the developer defined the meta tags). The web server (which would also need to be aware of this type of request), would then return back a certain sized image. This would require the least amount of effort by the developers and would just need support by the browsers and web servers.

  16. Re:does this mean.... by Applehu+Akbar · · Score: 2

    If only browsers were smart enough not to play audio in background tabs.

  17. Re:Client or Server side? by fyngyrz · · Score: 2

    layout constraints

    ...doing it wrong. The BROWSER should control the layout. Not the data source.

    --
    I've fallen off your lawn, and I can't get up.
  18. Re:Window size and pixel density in what header? by tepples · · Score: 2

    also, browsers can resize. It's not the server's job

    It's the server's job if the user doesn't want to have to download an ultra-high-resolution image over a metered connection. It also used to be the server's job back when web browsers insisted on using nearest neighbor resampling instead of bilinear or bicubic resampling.

    We don't have a bandwidth shortage.

    You appear not to know what it's like to be stuck on the 10 GB per month cap of wireless (satellite or cellular) home Internet access.

    If you know it's a mac or a PC, you know it's got a desktop range of pixels.

    But is that 1024 pixels wide with huge distracting white areas on both sides when viewed on a 2560 pixel monitor, or is it 2560 pixels wide with complete inability to see the entire image at once on a 1024 pixel monitor like the one in my laptop?

    Likewise any particular smartphone.

    A tablet held in landscape orientation runs the same operating system as a smartphone held in portrait orientation, despite the latter having only about one-third the horizontal width.

    Don't resize images with the viewport. That's very annoying. They should reflow with the window according to the browser's settings. If you set a constant width, then you're asking for scroll bars if the window can't fit that width.

    So what should a designer who doesn't want horizontal scrollbars do?

    HTML was intended as the content provider; the browser intended to be the content formatter

    And CSS (Cascading Style Sheets) was supposed to be the instructions that the content formatter follows.

    using only hints -- lines, paragraphs, font styling, etc. The closer you can get to that in web page design

    I imagine that as of 2014, most people would not prefer that most web pages look like Barry T. Smith's MFing Web Site. They would consider the default styling that a browser applies to the MFing Web Site to be unprofessional.

    Every time some whackjob decides that menus should drop or windows should open when my mouse pointer crosses some object, I curse.

    How would you prefer that a menu be opened while JavaScript is turned off? To the best of my knowledge, CSS supports only hover-to-show, not click-to-show.

    Every time I run into some page (like liveaquaria.com's) that won't run its cart or checkout through the usual standard ports and protocols

    Could you describe what nonstandard "ports and protocols" liveaquaria.com uses? I tried to buy a coral to test what you describe, but it required me to create a username and password before I could check out. Is the need to register before checking out part of the problem you describe? I do know that some manufacturers, such as Games Workshop, have a policy of forbidding online stores from selling their products through a standard shopping cart.