Slashdot Mirror


Google Releases Open Source 'Guetzli' JPEG Encoder (betanews.com)

BrianFagioli writes: Today, Google released yet another open source project. Called "Guetzli," it is a JPEG encoder that aims to produce even smaller image file sizes. In fact, the search giant claims a whopping 35 percent improvement over existing JPEG compression. If you are wondering why smaller file sizes are important, it is quite simple -- the web. If websites can embed smaller images, users can experience faster load times while using less data. While Google didn't aim to improve JPEG image quality with Guetzli, it seems it has arguably done so. It is subjective, but the search giant surveyed human beings and found they preferred Google's open source offering 75 percent of the time. Smaller file sizes and better image quality? Wow! Google has done something amazing here.

83 comments

  1. Not impressed by Anonymous Coward · · Score: 0

    We should use h265 to encode images.

    1. Re:Not impressed by Anonymous Coward · · Score: 2, Interesting

      No, they need to finish FLIF

    2. Re:Not impressed by Anonymous Coward · · Score: 0

      That's what you do with BPG, or rather, you use the free x265 to encode: http://bellard.org/bpg/

  2. BFD by Anonymous Coward · · Score: 1

    who cares.. most of the bloat in today's sites comes from the javascript blobs..

    1. Re:BFD by viperidaenz · · Score: 1

      Last time I checked JavaScript was transferred in character format, not binary

    2. Re:BFD by arth1 · · Score: 1, Insightful

      Which makes it even bloatier.
      And lossy compression doesn't work to well on it either...

    3. Re:BFD by Anonymous Coward · · Score: 0

      so? sites today are slow because of javascript not because of images.

    4. Re:BFD by Anonymous Coward · · Score: 0

      And lossy compression doesn't work to well on it either...

      Lossy compression of javascript works fukin awesome.
      Its called NoScript. Loses it entirely!

    5. Re:BFD by tlhIngan · · Score: 4, Informative

      Last time I checked JavaScript was transferred in character format, not binary

      You can send it as binary - use HTTP compression. I believe most webservers support it as do webbrowsers, so the javascript file is compressed and the compressed binary is sent over the wires, and the web browser will decompress the blob back to the original javascript.

    6. Re:BFD by Anonymous Coward · · Score: 0

      Last time I checked JavaScript was transferred in character format, not binary

      Last time I checked, pretty much all websites are gzipping their data before transfer, and typical JavaScript code gzips very tightly.

    7. Re:BFD by arglebargle_xiv · · Score: 1

      That was my reaction as well. Instead of:

      If you are wondering why smaller file sizes are important, it is quite simple -- the web. If websites can embed smaller images, users can experience faster load times while using less data.

      the summary should read:

      If you are wondering why smaller file sizes are important, it is quite simple -- the web. If websites can embed smaller images, they can use the saved space to load five different Javascript frameworks at 5MB apiece.

    8. Re:BFD by Anonymous Coward · · Score: 0

      > sites today are slow because of javascript not because of images.

      It can matter depending on your browser and platform.

      I worked on a site recently where every staff member's profile page included a 3/4 length shot of the person. Each one was a JPEG around 500kB. They really affected load times on mobile devices.

      I converted them to PNG and used TinyPNG to compress them. Most were reduced to less than 150kB and the difference in load times was very noticeable.

    9. Re:BFD by viperidaenz · · Score: 1

      That's not a Javascript blob, that's a zgip or deflate archive.

  3. Will probably also be useful for video keyframes by Anonymous Coward · · Score: 0

    This will probably be also be useful for videos.

  4. Just you wait... by Narcocide · · Score: 1

    ... until they're sued by Comcast, Cox, Verizon, T-Mobile, Sprint, AT&T, Disney and my Mom over lost profits from metered bandwidth fees. After all, it worked for the Oil industry for decades...

  5. I thought your mom would be happy... by Anonymous Coward · · Score: 0

    At least the hosting costs for her p0rn site will go down.

  6. Know how else users can get faster load times? by Red_Chaos1 · · Score: 5, Insightful

    By websites not have 20 tracking pixel GIFs, 50 different ad servers, 5 different CDNs, 10 tracking servers, and a partridge in a pear tree. Websites are built fucking stupid these days, too much shit relies on too many other sources to work correctly and if even one doesn't respond in a timely manner, the whole thing stalls.

    1. Re:Know how else users can get faster load times? by Anonymous Coward · · Score: 1

      Red_Chaos1 wins the thread. Next topic, please.

    2. Re:Know how else users can get faster load times? by Anonymous Coward · · Score: 1

      google pursues better video and image compression solely to benefit *them* (more compression = less storage space for them. more compression = more room on the page for the tracking and ad bullshit, autoplaying videos and other crap) and by purely coincidental extension, their advertising partners. they don't give a flying fuck about the end user.

    3. Re:Know how else users can get faster load times? by Zaelath · · Score: 1

      Yup, we're done here.

    4. Re:Know how else users can get faster load times? by ProzacPatient · · Score: 1

      I am the web developer and I approve this message.

    5. Re:Know how else users can get faster load times? by Anonymous Coward · · Score: 0

      I would add to this list also Flash-ads and auto-loading videos. What use is few kilobytes saved on GIFs compared to those...

    6. Re:Know how else users can get faster load times? by Anonymous Coward · · Score: 0

      This. So very much of this. You missed the 'sourced javascript includes from 10 different service providers' but thats probably well the fucking partridge right?

    7. Re:Know how else users can get faster load times? by Anonymous Coward · · Score: 0

      Agree on most of your points, but the CDNs really do help to speed things up. If sites are using a CDN rather than hosting the Javascript libraries and generic CSS themselves, there is a good chance that it is in your cache already. And if not, it is likely coming from a closer server. If you want to question the need for those Javascript and CSS files in the first place, you may have a point, but that is not the fault of the CDN.

    8. Re:Know how else users can get faster load times? by Martin+Blank · · Score: 1

      If sites are using a CDN rather than hosting the Javascript libraries and generic CSS themselves, there is a good chance that it is in your cache already.

      Depending on the source used, it may also have a more recent version of the JS library than might be otherwise used, as some of the CDNs that maintain the libraries automatically update to the latest compatible version.

      --
      You can never go home again... but I guess you can shop there.
    9. Re:Know how else users can get faster load times? by PedroReina · · Score: 2

      Of course you are right. But squeezing files on a web server is always wellcome. I routinelly optimize all my JPEG and PNG images on my site:
      optipng -q *.png
      jhead -purejpg *.jpg
      If the new algorithm is better than currents one, I'll use it.

    10. Re:Know how else users can get faster load times? by Anonymous Coward · · Score: 0

      Preach it Brother preach it ! !

    11. Re:Know how else users can get faster load times? by Anonymous Coward · · Score: 0

      Or...

      Now we can have 35% more ads in the same load time!

      Hurray!

  7. re: survey by Anonymous Coward · · Score: 0

    Is the survey comparing their 35% smaller JPEG to the "original size" JPEG (starting from the same reference lossless image), or is it comparing theirs to something with the same size as theirs?

    I'm impressed if and only if it's the former.

  8. finally by binarybum · · Score: 1

    about time google started to use middle-out compression techniques, but I feel bad for the little guys they stole it from.

    --
    ôó
    1. Re:finally by Anonymous Coward · · Score: 0

      I'd say 35% is only a fair to middlin' improvement.
      So Thomas Middleditch still has plenty to work with.

    2. Re:finally by eWarz · · Score: 1

      Hilarious, as I just got done watching S3 E4.

  9. Re:Is it written in Rust? by Anonymous Coward · · Score: 0

    I'll let you give me a Rusty trombone.

  10. Re:Will probably also be useful for video keyframe by cheater512 · · Score: 5, Interesting

    Until you read the bit about it needing 300mb of ram per megapixel of input data.

    I don't think we'll see any hardware encoders being able to implement the algorithm any time soon.
    And certainly not running in realtime on a CPU.

  11. Re:Will probably also be useful for video keyframe by LostMyBeaver · · Score: 1

    They're leaving pretty soon.

    There is little or no value to a full I frame anymore. These days, to handle better bitrate allocation within a video stream, it's better to avoid burstiness by spreading I macroblocks across more frames. Not only that, but I frames only provided good quality based on a timer, not based on when it was needed. So for example, a blinking traffic light might have had to be encoded as B blocks which are actually quite inefficient when handling major changes and also requires a great deal of stream latency since the forward prediction block might be quite far off in time. So, being able to inject a new I-block when needed instead of on a schedule could produce mostly I and P video while reducing latency and compensating for loss of bandwidth saved with long distance prediction with B blocks by sending less I data to begin with.

    It's also nice in environments where pure I/P video can be popular and the companies delivering the media employ both spacial and temporal compression techniques as the I data when it is transmitted can be used to provide enough information per frame to allow for fast scrubbing of media in post production which would allow for better solutions than Avid or Apple codecs.

  12. Weak statistics by manu0601 · · Score: 3, Insightful

    the search giant surveyed human beings and found they preferred Google's open source offering 75 percent of the time.

    How many human being? It is in the research paper:

    23 raters participated in our experiment.

    Statistics on 23 persons seems rather weak.

    1. Re:Weak statistics by Anonymous Coward · · Score: 0

      Meh still better than using ten cats.

    2. Re:Weak statistics by radarskiy · · Score: 5, Informative

      At a 95% confidence level, a sample of 23 will give you a range of +/-18% on that 75% result (57%-93%). At 99% confidence level, the range is +/-23%. We can be pretty confident that more will prefer the Google result than not.

    3. Re:Weak statistics by Anonymous Coward · · Score: 0

      How did you compute that without knowing the sample standard deviation? It might be in the article of course.

  13. Re:Is it written in Rust? by LostMyBeaver · · Score: 2

    Written in C but using a C++ compiler for namespace handling.

    I can't provide a why or why not other than "does it really matter?"

  14. Re: need option to "Not load more than 5 sites per by Anonymous Coward · · Score: 0

    Yes, A page should not contact more than 5 or say x count of other sites. First come first listed in the source code basis

  15. Re:Will probably also be useful for video keyframe by Anonymous Coward · · Score: 0

    I looked at the code and it looks like they allocate a ton of memory, using it and then keeping it around without freeing it. There seems to be the habit of using data in one step and then copying the data to a new block of memory and using the copy for the next step. There could probably be some large gains through fixing the use of memory like that.

  16. ZIP transfer by Anonymous Coward · · Score: 0

    Web data is transferred either as text, as ZIP streams or as DEFLATE streams.

    So if you want to reduce the transfer size, most browsers will send a header : "Accept: Zip, Deflate...", and Apache will automatically compress and send the data in zip or deflate when configured to enable the feature.

    So this isn't as useful as you might think. But it *will* replace other libraries for the same purpose and you'll see it pop up in other products.

    *HOWEVER*, can someone check the code to ensure it doesn't put tracking data in based on the PC's its run on, because this is Google and they ram their tracking shit down everyones throats.

    1. Re:ZIP transfer by l20502 · · Score: 1

      Good thing web appers found out how to "minify" everything into an unreadable mess in order to save a couple hundred bytes

    2. Re: ZIP transfer by Anonymous Coward · · Score: 0

      deflate or zip has a different application and different efficiency results then jpeg or the new improvement. Zip/deflate does not achieve good results on original raw photo data Compared to lossy algorythms like jpg.

  17. Re:Is it written in Rust? by Anonymous Coward · · Score: 0

    The original version was written in Rust...it's still compiling.

  18. Re: re: survey by Anonymous Coward · · Score: 0

    I dare you to read TFS.

  19. Ghost of Jon Katz by Anonymous Coward · · Score: 0

    >If you are wondering why smaller file sizes are important
    >If websites can embed smaller images, users can experience faster load times while using less data
    >Smaller file sizes and better image quality? Wow!

    It's incredible to think that someone actually wrote this for a slashdot submission, and that it was approved. As I typed this I immediately thought it must have been approved by BeauHD.

  20. Re: need option to "Not load more than 5 sites per by Anonymous Coward · · Score: 0

    Yes, A page should not contact more than 5 or say x count of other sites. First come first listed in the source code basis

    So then the sites would sacrifice the content and serve only ads?

  21. Guetzli? by Kokuyo · · Score: 1

    I never thought I'd ever see the day that a large international corporation gives its product a Swiss-German name.

    1. Re:Guetzli? by Anonymous Coward · · Score: 0

      They do have large offices in Zurich.

    2. Re:Guetzli? by Anonymous Coward · · Score: 0

      There's also Brotli and Zopfli (no joke)

    3. Re:Guetzli? by TeknoHog · · Score: 1

      I'm trying to make a joke about Nestle here, but I'm afraid my brain is rotten after eating everything they produce.

      --
      Escher was the first MC and Giger invented the HR department.
  22. Re: survey by Anonymous Coward · · Score: 0

    "35 percent improvement over EXISTING JPEG compression."

  23. Guetzli means Cookie in Swiss German by Anonymous Coward · · Score: 5, Informative

    Just so you know

  24. Re: survey by Anonymous Coward · · Score: 0

    No shit, sherlock. We know that part. I'm asking about what the survey compared it to.

  25. Re: Will probably also be useful for video keyfram by Anonymous Coward · · Score: 0

    There is no algorithm that can decide jpeg in real-time. The reason for this is that an image is an instant. It doesn't have a duration like video. Most other jpeg compression algorithms are also relatively slow.

  26. Ram Up by Anonymous Coward · · Score: 0

    Note: Guetzli uses a large amount of memory. You should provide 300MB of memory per 1MPix of the input image.

    Github

  27. Re:Is it written in Rust? by Anonymous Coward · · Score: 0

    No it's not written in Rust, do not be silly. Who wants to install all the bloated self-referential wankery that makes up the Rust toolchain?

    It is written in C++, as is butteraugli the library it depends on. So to compile butteraugli you first need install bazel*, Google's build tool which itself requires a Java runtime...

    .

    .

    .

    .

    * actually there is a makefile included for the 3 files comprising the source code, but it's nowhere near as enterprisey as installing bazel and Java. Just look at it...

    LDLIBS += -lpng -ljpeg
    CXXFLAGS += -std=c++11 -I..
    LINK.o = $(LINK.cc)

    all: butteraugli.o butteraugli_main.o butteraugli

    butteraugli: butteraugli.o butteraugli_main.o

  28. Re: survey by Sivaraj · · Score: 4, Informative

    I don't know what the survey compared it to. But I did a quick test with the same result.

    Source: https://en.wikipedia.org/wiki/... (a resized version was used)

    Input Image: ../zayapa.jpg JPEG 1608x949 1608x949+0+0 8-bit sRGB 1.097MB 0.000u 0:00.000
    Output Image: zayapa.jpg[1] JPEG 1608x949 1608x949+0+0 8-bit sRGB 641KB 0.000u 0:00.000

    Only "gotcha" is:

    $ time guetzli ../zayapa.jpg zayapa.jpg

    real 5m39.725s
    user 5m35.340s
    sys 0m4.188s

    It is a relatively low-end Pentium processor, but still over 5 minutes to compress a 1MB image is too high.

  29. Re: Will probably also be useful for video keyfram by Desler · · Score: 1

    Bullshit. MJPEG is used in almost all security cameras running at 30 or 60 fps in real-time.

  30. Looks good by Anonymous Coward · · Score: 0

    I just tried it out on a 550kb jpg and it reduced the size to around 450kb. It looks nearly identical except a few pixels maybe moved in some dark areas - only noticeable when switching back and forth between the two.

  31. Stop the JPEG, GIF, and PNG nonsense by Anonymous Coward · · Score: 0

    and put everything behing BPG. There are no longer any requirements for license or royalties for the use of the HEVC components for most cases of decoding BPG images. Now is the time to get rid of decades old image formats.

    1. Re:Stop the JPEG, GIF, and PNG nonsense by fyngyrz · · Score: 1

      I'm not a fan of lossy image compression anyway. It can accurately described as "a way to damage images."

      --
      I've fallen off your lawn, and I can't get up.
    2. Re:Stop the JPEG, GIF, and PNG nonsense by Anonymous Coward · · Score: 0

      Until there is browser support, BPG is a non-starter.

    3. Re:Stop the JPEG, GIF, and PNG nonsense by Anonymous Coward · · Score: 0

      The fact that they have now abandoned licensing and royalty payments for most cases of decoding images IS the starter for BPG browser support.

  32. It's like the OGG/Vorbis of JPEG by pecosdave · · Score: 1

    That's right. I'm that one asshole using OGG and annoying people with it.

    --
    The preceding post was not a Slashvertisement.
    1. Re:It's like the OGG/Vorbis of JPEG by Anonymous Coward · · Score: 0

      I'm afraid I'm the second asshole...

      All my FLACs go through oggenc.

    2. Re:It's like the OGG/Vorbis of JPEG by sexconker · · Score: 1

      I like OGG, but if I have the option I just FLAC it.

    3. Re:It's like the OGG/Vorbis of JPEG by TeknoHog · · Score: 1

      Yes, because Vorbis is a better encoder for the MP3 format, instead of a completely different format, to continue your analogy in the most logical fashion.

      --
      Escher was the first MC and Giger invented the HR department.
  33. Minification, not NoScript by tepples · · Score: 1

    Lossy compression of javascript works fukin awesome.

    If you're referring to minification, I'm inclined to agree. It loses variable names and internal comments, compressing them to a table mapping minified JavaScript files to their source code.

    Its called NoScript. Loses it entirely!

    Installing that and then not whitelisting any sites makes interaction with web applications require a full page reload for each update. Good luck getting web-based chat to refresh in a timely manner or making web-based image editing programs respond quickly without script. I assume that web users who find full page reloads inconvenient outnumber web users who are paranoid about a site owner running code in a sandbox on the user's computer.

  34. Keyframes are for seeking by tepples · · Score: 1

    There is little or no value to a full I frame anymore.

    Adding more intra-frames reduces the time that a throbber is displayed when the user has chosen to seek to a different point in a recorded video or join a live stream in progress. And as you pointed out, "scrubbing" is the upper limit of seeking speed.

    I frames only provided good quality based on a timer, not based on when it was needed.

    That depends on the video encoder. Older real-time MPEG-1 and MPEG-2 encoders had a rigid "group of pictures" (GOP) structure that inserted I frames on a timer. Apple's HTTP Live Streaming breaks a video into a playlist of four-second segments, each of which needs to start with an I frame. But if you don't plan to let viewers seek or join a live stream in progress, you can use automatic keyframe detection with I-to-I intervals capped in the hundreds of frames.

  35. But what is a distinct site? by tepples · · Score: 1

    A page should not contact more than 5 or say x count of other sites.

    By "other sites" do you mean other origins, where an origin is a (protocol, hostname, port) tuple, or other registrable domains as defined by the Public Suffix List? For connection overhead purposes, you want origins, but for privacy purposes, you want registrable domains.

  36. Re:Will probably also be useful for video keyframe by Anonymous Coward · · Score: 0

    Video keyframes already use newer algorithms than JPEG that are about twice as space-efficient for the same quality. There were attempts to use them on the web that got bogged down by patents, but "webp" is a VP8 keyframe:

    https://groups.google.com/a/webmproject.org/forum/#!topic/webp-discuss/Dj8UGeaHDAY

    it's better than this release. The news here is some moderate space savings without changing the decoder.

  37. What license is required for encoding BPG? by tepples · · Score: 1

    There are no longer any requirements for license or royalties for the use of the HEVC components for most cases of decoding BPG images.

    Citation? And what license is required for encoding, such as a server that makes BPG thumbnails of uploaded JPEG or PNG images?

    1. Re:What license is required for encoding BPG? by Anonymous Coward · · Score: 0

      No license required for encoding, hence why we have x265, which is the free alternative to the patent-encumbered h265 reference, a.k.a HEVC.

    2. Re:What license is required for encoding BPG? by tepples · · Score: 1

      If x265 implements the same encoding methods as HEVC, which it probably does if it creates a compatible bitstream, it's covered by the U.S. patents that cover HEVC. That's the whole concept of "essential patents".

  38. Google buys Pied Piper by Anonymous Coward · · Score: 0

    Google becomes Hooli? They just discovered middle-out compression?
    Pied Piper was years ahead of them!

  39. Not impressed by Waccoon · · Score: 3, Informative

    I just gave this thing a try on a Win7 x64 box on a Core i5 3770K @ 3.4 GHz, and the results are... interesting, but not in a good way.

    First, I tried to explicitly use a quality level of 78% to test it against some low-quality images, and the program immediately yelled at me that if I want to use a setting below 84%, I need to modify the source code and recompile. WTF? Do we really need idiot-proofing of command-line utilities, too? Second, I found out that setting a quality of 88% actually sets the quality much higher than 90%, resulting in huge, HQ files. I have no idea how they determine the quality from the command-line flags as I haven't looked at the source, but apparently this program is pretty buggy. Unsurprisingly, like most programs these days, Guetzli only utilizes one CPU core, so it will be slow, but at least it won't lock up your machine while it works.

    Anyway, compared to the default Photoshop "save for web" feature, this program makes files about the same filesize, but takes about 200-300x as long (roughly 1.5 minutes for Guetzli compared to less than a second for Photoshop). All my test images were between 0.5 to 1.0 megapixel, and consisted of gradient shaded cartoons and a few shaded pencil drawings, which normally show horrible artifacts and are difficult to compress well. For the images I used at 90% quality, there's apparently no real advantage. I couldn't get the quality settings in Guetzli to work correctly, so I did the runs with Google's tool first, then made comparable images with Photoshop to match the quality. File size differences were less than 10%. I did find that that Guetzli prioritizes chroma over luminance, so strong colors have fewer artifacts, but base colors and B&W patches have more artifacts and are blurrier. The net quality is about the same overall, so this tool is disappointing. If you're going to use this utility, it's best reserved for highly saturated pictures, but overall I didn't see any gains in compression.

    If you're looking for serious gains in compression, you're better off using PNGOut by Ken Silverman to crush PNG files. It's usually not worth trying to get more compression out of JPEG files over a utility like Photoshop, Irfanview, or ImageMagick. Even JPEGTran never gave me any significant gains over Photoshop's JPEG routines.

  40. Re: survey by Areyoukiddingme · · Score: 1

    It is a relatively low-end Pentium processor, but still over 5 minutes to compress a 1MB image is too high.

    Is it? It only has to be compressed once and put on a website, where it will be served to a million browsers and decompressed a million times. Does decompression take any longer?