
BPG Image Comparison - rayshan
http://xooyoozoo.github.io/yolo-octo-bugfixes/#soccer-players&webp=s&bpg=s
======
codexon
I think the big question is whether people can put BPG pictures online without
getting sued.

 _edit_

Why am I being downvoted for saying this? Do the people downvoting me realize
that BPG is using HEVC which is patented by many entities?

~~~
wtallis
How could distribution of the encoded images be infringing a patent? It's the
distribution and possibly use of the encoders and decoders that would be
within the scope of patent law, not the output itself. The encoded image isn't
the invention.

If I own a patented 3d printer, would you be worried that those patents could
restrict my ability to distribute the objects printed by it?

The javascript decoder would certainly be covered by the patents as much as
any other decoder, so it doesn't solve the patent-related barriers to adoption
even if it takes care of the practical issues with using the format.

~~~
codexon
Err, because MPEG-LA and the other patent holders that didn't join knows that
Fabrice Bellard didn't license the patent from them, so you used an unlicensed
_encoder_.

If you stick that poly-fill on your website they can also sue you for
distributing the _decoder_ to everyone that downloaded the javascript file.

~~~
reubenmorais
IANAL, and this might be a simple case of letter vs. spirit, but my
understanding was that shipping the decoder's source is allowed, so with a JS
implementation you're theoretically safe. This was one of the arguments around
Broadway, the JS H.264 decoder.

~~~
tjohns
I'd argue there's a difference between shipping source code, and actually
embedding it in your page via a <script> tag. Once you embed the script into
your page for execution, you're building a derivative work -- not just
publishing technical details.

Otherwise JS would become a universal patent loophole, which I'm pretty sure a
judge would find fault with.

(IANAL also.)

------
nl
I wasn't aware, but BPG is a Fabrice Bellard[1] project.

Bellard is possibly the best example I'm aware of the 100x programmer.

[1] [http://blog.smartbear.com/careers/fabrice-bellard-
portrait-o...](http://blog.smartbear.com/careers/fabrice-bellard-portrait-of-
a-super-productive-programmer/)

[2] A subset of things he started: LZEXE, FFMpeg, QEMU. He's also held the
record for the calculation of the largest known prime and the most digits of
Pi, wrote the first x86 emulator in JS that could boot Linux, won the
International Obfuscated C Contest, etc etc.

~~~
sillysaurus3
I'm concerned that highlighting his accomplishments every time one of his
projects comes up gives the wrong impression to the newer programmers reading
the site, or even to experienced programmers.

You, reader, can be a Bellard. There's nothing "special" about what Bellard
has done, in the sense of it being beyond your abilities. You just have to
believe in yourself, along with having a willingness to work hard most days.
But working hard is easy when you find an interesting problem.

Bellard is able to do so much because knowledge is like compound interest: The
more you know, the more you can learn. Bellard has been saving up for a long
time.

Competition is sometimes motivational, and if you insist on looking at it like
a competition, then realize that every day Bellard devotes to relaxation is a
day you can catch up to where he's at. Competition is what motivated me, when
I first started. And once you realize there's nothing magical about what they
know, you realize you can sprint very hard towards where they're at, which is
exciting.

But once you start down that path, competitive spirit tends to transcend into
something else entirely. You stop comparing yourself to others. You focus on
putting one foot in front of the other, taking the next logical step towards
your goal. Repeat for N days, and suddenly people are highlighting the
projects you've done.

But what's your goal? Well, that's up to you.

So pursue your interests! You can do it.

~~~
deathanatos
I'd love to believe this, but it's my day job. By the time I've poured my
brain 9–5 into what my employer wants, I just feel too drained to do what I
want.

It's a vicious cycle of desire and fatigue.

~~~
kordless
> too drained

Drained, or scared?

~~~
001sky
I'm pretty sure there is no need to troll this comment.

Even if your point was logical, it would be debatable.

~~~
spoiler
I believe the comment was meant to motivate, or provoke a bit of self-
reflection; not for trolling.

Many people are unwilling, or can't or look for excuses to not take the first
step because fear[1][2] might be (secretly) hindering them.

I was offered a great job and I was afraid/unwilling to take the job because
of the responsibility in involved (even though, I would've loved the job) and
was afraid I wouldn't be up to the task or _my own_ expectations (now I
realise I would've been more than capable).

Although, my issue was a consequence of a much bigger emotional problem, I
wouldn't have ever resolved it, if it wasn't for a tactless and stubborn
friend who forced me into helping myself.

Just my two cents.

\--

[1]:Atychiphobia

[2]: or Jonah's complex

~~~
kordless
Yes. I realize the comment was short and blunt, but the intent behind it was
simply to question motivations behind "working for the man" and "doing what
brings you joy". I encourage everyone to consider the risks and fears
associated with building something new and revolutionary. Sometimes that takes
digging deep and facing your fears!

------
ogig
Compare original vs BPG in the soccer picture, then look at the green strip on
the shirt of the red team player and slide over it. It's magical how perfectly
the compresion make the red dots disappear.

~~~
viraptor
Another great one is the Irish Mannequinn. I thought BPG blows up the edges,
because every other format smoothed them out. But no, when you compare to the
original, all the interesting edges (hair, hanging fabric, top of the lips)
should be very visible.

I really like the results!

~~~
k__
Yes, it seems like BPG is smarter in finding interesting parts of the image.

------
jmspring
This conversation showed up a couple of weeks ago...

Any new "image compression format" isn't going to gain widespread traction
unless is can displace JPEG in terms of hardware support and ubiquity in
cameras.

I was part of the JPEG-2000 support. The company I was with at the time had
technology around how blocks were encoded (it gave up block independence at
the benefit of 20+% encoding efficiency -- downside would be an intermediary
step to reconstruct the JPEG steam).

None of those solutions took off.

Explain to me how beyond a hobbyist market BPG will make a splash?

~~~
jacobolus
It’ll make a splash if (0) the legal issues are sufficiently sorted out so
that adopters don’t feel threatened using the format (1) the polyfill works
everywhere, as it seems to, without too substantial a slowdown, (2) it saves
enough bandwidth that major websites start sending BPG instead of JPG to at
least some web clients, (3) one or more major browsers decide to build in
native support, and maybe an extra boost (4) it manages to support use cases
that other formats don’t handle well (e.g. photographic/naturalistic images
with full alpha channel) and carves out a niche as the main format for those
particular types of images.

I can imagine Safari and IE building support for this format entirely as a
counter to Google’s WebP, since they already need support for HEVC as a matter
of course.

Many current websites send very heavily compressed JPEG images to save
bandwidth, and just live with the big hit to image quality. If they had a
similar-filesize alternative that they could use for some or all clients that
didn’t degrade image quality, and still was guaranteed to work smoothly, it’s
plausible they might adopt it.

~~~
jmspring
Who is going to re-encode their images en masse? Content companies? Photo
sites?

~~~
lmm
Facebook. Which is probably a large percentage of the images going over the
web. Heck, they could start by just doing it on mobile.

~~~
saiya-jin
Nobody will reencode anything in photo sites. Just newer content will be
supported. As for FB, their internal re-compression of jpegs is annoying as
hell. Fine details taken with D750 become blocky almost cell phone quality
images. Solution? Upload PNG.

------
corysama
If an American company incorporated Bellard's reference decoder into a
commercial product that is distributed in binary form to clients, would that
company need to license the HVEC patents to avoid being sued by an HVEC patent
holder?

~~~
pdq
Almost certainly yes, you would need to license the many patents covered in
H.265 and H.264.

However if you look at the history of JPEG and MP3, which were also encumbered
with patents, the public domain basically won due to the sheer number of
violations being too large to take down or even force licensing.

It will be interesting to see if any product (ie browser) actually puts any of
these algorithms in their codebase.

------
tambourine_man
Jaws dropped. Maybe having the option of adding 1-2% of luminance noise after
decompression to disguise the plastic feel would make it look even better. It
would look a bit different every time you load the image, though.

I would love to be able to use this today.

~~~
anyfoo
Must not necessarily look different: use a PRNG with a fixed seed, possibly as
part of the image itself. Since there's nothing cryptorelevant here, the PRNG
can be a simple one and its exact parameters specified as part of the
standard.

------
steadicat
BPG does a much better job at smaller sizes: its artifacts are way less
jarring than JPEG’s (they just look like smudges).

However, to my eye, Large is the only acceptable quality level on these
examples, and at Large the difference between JPEG and BPG looks almost
imperceptible. Considering the cost of polyfilling, I would stick with JPEG.

~~~
jacobolus
> _However, to my eye, Large is the only acceptable quality level on these
> examples, and at Large the difference between JPEG and BPG looks almost
> imperceptible._

I feel we must be looking at different examples, or must have very different
definitions of “imperceptible”. I find that there is a very substantial
difference in high frequency detail between mozjpeg and BPG in nearly all of
these examples at the 'large' size, as well as many images where mozjpeg
produces highly objectionable artifacts even at the 'large' size and BPG does
not.

Speaking for myself, I would prefer to use a higher quality setting than any
of the ones demonstrated even with BPG for most of my personal purposes. For
my typical use cases, the 'large' BPG versions of most of these images are at
the edge of acceptable quality, and every one of the other compressed versions
falls far short of acceptable.†

Many other people have use cases where precise image replication isn’t as
important though, and at every size BPG seems like a dramatic step up over the
competition.

One thing I hope gets worked out before this goes mainstream is color
management / color profile support. In Safari on my Mac there are several
images where the rendered BPG image is obviously not correctly applying the
image’s color profile.

† Kakadu’s JPEG2000 encoder and WebP at that 'large' size also seem noticeably
better than mozjpeg, but they still seem to wipe more high frequency detail
and produce more artifacts – especially edge artifacts – than BPG. On some
images packed with very high contrast fine detail (e.g. Vallée de Colca), WebP
performance and BPG performance seems pretty similar and a bit better than
Kakadu; in general compression is hard in these cases so the “large” size ends
up being pretty large.

------
simonsarris
When I clicked it I thought this was supposed to be a test damning BPG
somehow, but I get the impression from other comments that I am NOT supposed
to see this: [http://i.imgur.com/XDXOB2w.jpg](http://i.imgur.com/XDXOB2w.jpg)

All the other image formats work fine.

Any idea why? Windows Chrome 41.0.2243.0 dev-m (64-bit)

~~~
lstamour
I see it too. Identical version: 41.0.2243.0 dev-m (64-bit) and also on
Windows. I see it here as well:
[http://bellard.org/bpg/lena.html](http://bellard.org/bpg/lena.html) which
explains "The BPG images are decoded in your browser with a small Javascript
decoder." You can find more on the format at:
[http://bellard.org/bpg/](http://bellard.org/bpg/)

Someone filed a bug today:
[https://code.google.com/p/chromium/issues/detail?id=442599](https://code.google.com/p/chromium/issues/detail?id=442599)

Fixed in Canary 5 days ago:
[https://code.google.com/p/chromium/issues/detail?id=439743](https://code.google.com/p/chromium/issues/detail?id=439743)

~~~
swasheck
OT ... but I find Canary to be much more usable and stable than Dev.

------
chipsy
The "Production" picture [0] is quite challenging for all encoders. The
original has fine details like text that are smoothed out of existence even in
the "Large" profiles - though to its credit BPG preserves more of it than the
others. (Also, relative to other high-detail pictures this one has an
unusually low filesize.)

[0] [http://xooyoozoo.github.io/yolo-octo-
bugfixes/#production&bp...](http://xooyoozoo.github.io/yolo-octo-
bugfixes/#production&bpg=l&png=s)

------
Scaevolus
previously:
[https://news.ycombinator.com/item?id=8735572](https://news.ycombinator.com/item?id=8735572)

BPG context:
[https://news.ycombinator.com/item?id=8704629](https://news.ycombinator.com/item?id=8704629)

------
frontsideair
Maybe Bellard is reading these comments. I made a very unpopular remark about
his use of Lena.jpg and while I believe it's mostly coincidence, he used an
imageset without Lena.jpg.

If you're reading, Bellard, hi!

~~~
akie
Ignore the haters - I read your comment and upvoted it. It _is_ everyday
sexism and role-confirming behavior, and it _is_ off-putting to women and
making them feel unwelcome. But I think people are not aware of it and mean no
harm, which is why it's good you pointed it out.

I do think some people can only relate to the argument when you propose to
replace Lena with a seductively pretty half-naked (gay?) man, though.

~~~
hashmymustache
I'm trying to figure out why it's inherently sexist. The woman in the photo
posed, doesn't object to its use, gave a presentation about herself at an
imaging conference, and had a career helping handicapped people work on
computers. Image compression algorithm's are tested against faces since that's
what we take the most pictures of. This took hold for whatever reason.

The reflexive hate for anything "role-confirming" is sexist in denying
legitimacy to any man/woman in that role.

Fine change it to a half-naked guy. I don't know why if he's gay it'd make a
difference, but sure.

~~~
frontsideair
I'll try to answer to this as best as I can, since I'm new to this feminism
thing there's bound to be stuff that I'll miss.

Well first of all it's very nice of her approving the use of image and Playboy
too for not going after their rights. But I think it's far fetched to see her
approval as a positive message. There are women out there contributing to the
objectification of women too, for whatever reason they have. (One weird side
of this is people think women are shielded from criticism of their own
objectification, but it's a delicate matter to say the least. One has the
right to objectify _themselves_ so it's hard to say something without getting
in the way of their right to self express.) There are more than one side to
this issue; but it's not about her consent, it's about how it might be
contributing to boys club image of tech.

It's easy to see that we have a problem of the lack of women in tech. I find
this very depressing since they're able as much as men are and it looks
wasteful to dismiss half the population. I think we're getting better each
day, but it does not happen magically. People fight for it and will keep
fighting until there's no discrimination based on sex. I accept that Lena
image is one of the minor issues, but I still see this as one of the factors
that drives women away. This boys club image of tech gives the implicit
message that women are not wanted here.

I know there's no nudity in the image and one needs to research to find its
origins in Playboy so it seems unlikely to come across it. But the real reason
here is if we're willing to combat sexism, it will give women comfort that
we're willing to change tradition to be more welcoming. I believe actions
speak louder than words, and if the reason to keep the tradition is not all
that important, we should do it.

(I also don't think it's fair to compare it to an image of a naked guy, since
it's unlikely to drive boys away from tech. It's not just naked guy vs. naked
girl, the context and the message makes a world of difference.)

------
pdkl95
Very nice compression! As others have mentioned, BPG seems to be a bit better
at picking which details to save. It's an improvement over mozjpg - even at
"tiny" size, the usual (and annoying) "JPEG/MPEG-style block noise" seems to
be eliminated. (no offense intended to mozjpeg, which is working from an old
spec)

\--

Speaking of image formats, it might be nice to have a new format where the
container is designed to only allow a minimum of features. Something like a
file with only [MagicNum, xsize, ysize, xdpi, ydpi, gamma, <compressed
pixels>, CRC32].

The idea is that it should NOT support "metadata" like comments or EXIF. As
we've seen, there is a problem with getting most people to understand that
they should probably strip EXIF/etc before uploading, and having a format
where we could say "only upload .foo pictures" instead of "run $tool to strip
EXIF". A browser plugin could even auto-convert every image while uploading.

Unfortunately, it would face the same problem as any new image format: nobody
wants to use a new format until it is already popular.

------
mda
Do you think the difference (especially for medium and large versions) is
worth using a patent encumbered format?

------
z-e-r-o
It's interesting how bad mozjpeg looks compared to classic jpeg compression
tools like jpegoptim, given how many blogs have been writing about Mozilla
creating the "ultimate" jpeg encoder. Comparing it with jpegoptim reveals that
at the small-medium-large sizes mozjpeg produces a result with more visual
artefacts.

    
    
      wget http://xooyoozoo.github.io/yolo-octo-bugfixes/comparisonfiles/Original/Ricardo_Quaresma-L-,_Pablo_Zabaleta-R-Portugal_vs._Argentina,_9th_February_2011.png -O src.png
      convert src.png -quality 100 -sampling-factor 1x1 full.jpg
      jpegoptim -s full.jpg -S85 --stdout > s85.jpg
      jpegoptim -s full.jpg -S50 --stdout > s50.jpg
      jpegoptim -s full.jpg -S30 --stdout > s30.jpg
      jpegoptim -s full.jpg -S18 --stdout > s18.jpg

~~~
sp332
How are the file sizes?

~~~
z-e-r-o
Exactly 18-30-50-85 kB if you use the -S syntax.

~~~
sp332
Whoops, I assumed that was an arbitrary "quailty" setting. Thanks

------
rasz_pl
opera 15:

[16/12/2014 06:25:05] JavaScript - [http://xooyoozoo.github.io/yolo-octo-
bugfixes/](http://xooyoozoo.github.io/yolo-octo-bugfixes/) Inline script
thread

Uncaught exception: TypeError: Cannot convert 'file' to object

Error thrown at line 5, column 4 in <anonymous function>() in
[http://xooyoozoo.github.io/yolo-octo-
bugfixes/js/splitimage2...](http://xooyoozoo.github.io/yolo-octo-
bugfixes/js/splitimage2.js):

    
    
        for (i = 0; i < file.length; i++)
    

called from line 1, column 0 in [http://xooyoozoo.github.io/yolo-octo-
bugfixes/js/splitimage2...](http://xooyoozoo.github.io/yolo-octo-
bugfixes/js/splitimage2.js):

    
    
        (function() {

------
PythonicAlpha
Fruits: Mozjpg medium is still worse as BPG and is nearly double the size, it
leaves a lot artifacts in the cloudy areas. Found it very convincing.

I think the results depend a little on the kind of input, but some of the
pictures where rather convincing. WebP seems to do better than jpeg.

~~~
kevingadd
A key observation is that WebP biases towards smoothness (which certainly
produces pleasing images!) at the cost of sacrificing detail. mozjpeg produces
images with numerous macroblocking artifacts (ick) that seem to preserve more
of the original image detail, from the cases I looked at.

------
comex
Note that the decoder is 68K compressed. That's not much, and of course can be
cached, but considering that the improvement (from WebP, anyway) seems to be
most notable for the <50K images, it may not be terribly practical...

Considering that the page says it's based on a Daala comparison page, it would
be interesting to stick a Daala snapshot in the mix for comparison using the
same images (reencoding to PNG like it does for WebP, I'm not suggesting
porting Daala to emscripten). A quick browse of the original page shows Daala
sometimes beating x265, sometimes losing to it, but I guess both x265 and the
Daala {encoder, codec} may have been improved in the last six months.

------
Zardoz84
I would love see how does with scanned documents for preservation ... for
example :

\- [http://www.digibis.com/digibib-
demo/i18n/catalogo_imagenes/g...](http://www.digibis.com/digibib-
demo/i18n/catalogo_imagenes/grupo.cmd?path=1000009&interno=S&presentacion=pagina&posicion=1)

\- [http://www.digibis.com/digibib-
demo/cartografia/es/catalogo_...](http://www.digibis.com/digibib-
demo/cartografia/es/catalogo_imagenes/grupo.cmd?texto_busqueda=&path=1000114&interno=S&presentacion=pagina&posicion=1)

------
bhouston
Seems to give screwed up results for the BPG in Google Chrome Dev: Version
41.0.2243.0 dev-m (64-bit) But works in my copy of Firefox.

~~~
azakai
Same results here too - corrupted in Chrome 41, works ok in Firefox. Filed a
bug:
[https://code.google.com/p/chromium/issues/detail?id=442599](https://code.google.com/p/chromium/issues/detail?id=442599)

~~~
lstamour
And as reported in the above bug, fixed 5 days ago. We're living in the almost
bleeding edge here ;-)
[https://code.google.com/p/chromium/issues/detail?id=439743](https://code.google.com/p/chromium/issues/detail?id=439743)

------
wolf550e
Why does the comparison use x265 instead of the reference HEVC encoder?
Fabrice Bellard recommends that as it produces better quality encodes at the
expense of CPU time.

I'm interested in seeing the result of using 4:4:4 with BPG. If you have the
originals to compress, of course (meaning, the original is not chroma
subsampled).

~~~
xooyoozoo
He either made his judgement based on non-obvious criteria or, more likely,
looked at x265 at the "wrong" moment. Right before libbpg was announced, x265
had several commits fixing large 10bit and 422/444 bugs.

As far as intra-prediction goes, x265 should be better than the HM by at least
a few percents MSE-wise and around 10% SSIM-wise[0].

[0] [https://github.com/strukturag/libde265/wiki/Intra-
Prediction...](https://github.com/strukturag/libde265/wiki/Intra-Prediction-
Mode-Algorithm)

~~~
wolf550e
Integration with that library would be great too. Thanks for the link!

------
randerson
Subjectively, the best overall trade-off between quality and file size seems
to be BPG Large. Great comparison.

------
citrin_ru
Is anybody has comparison of original image and one decoded from BPG with
highlighted difference? E. g. using Imagemagick's compare command. It is
interesting in which areas BPG differ from original.

------
koliber
I just wanted to point out, that BGP in "tiny" mode changes the image quality
in a way that is strangely reminiscent of film. A lot of details get blurred
out, but in a pleasant way.

------
tedd4u
It's interesting to see the comparison at a fixed output size. It would also
be interesting to see a comparison at a) fixed encoding time, b) fixed
decoding time.

------
kmfrk
Makes me happy that the JS method used doesn't require me to do the same
<picture> <source> and provide multiple formats to support older browsers.

------
turbolent
Impressive. What are the differences for decoding/load time? Especially on
mobile devices this is a big deciding factor.

------
Kiro
I want to see a comparison with a normal JPG picture.

~~~
tempestn
You can compare between JPG and BPG by choosing "Mozjpeg" on one side and
"BPG-x265" on the other. There are many pictures to choose from. Or did I
misunderstand your question?

------
chernoby
bpg is definitely better for tiny pictures

------
skrowl
Yay! Another new image thing for 1 browser to support and the rest to need
polyfills for!

~~~
callahad
Check the discussion from 11 days ago. I think your concerns are misplaced.
BPG ships a polyfill... and it works. That's what you're seeing live on the
parent page. Previous discussion:
[https://news.ycombinator.com/item?id=8704629](https://news.ycombinator.com/item?id=8704629)

