
BPG Image format - jhabdas
https://bellard.org/bpg/
======
rudolfwinestock
Note that the author of the linked page is Fabrice Bellard. He created a PC
emulator in JavaScript.

[https://bellard.org/jslinux/](https://bellard.org/jslinux/)

He's also made several other impressive hacks:
[https://bellard.org/](https://bellard.org/)

~~~
nailer
Just reiterating this. Same guy behind FFmpeg, QEmu. One of the living
legends.

~~~
shawn
Pointing this out discourages others from posting things to HN. Why bother
posting your own stuff when you're not a legend?

I've seen this in practice, so it's not theoretical. It's the main reason my
friends don't even try.

But the reason is more subtle than that. Say you made BPG. If you don't have
past accomplishments, people will tear you to shreds here. Yet the comments
are all "Look at what this genius has made."

I'm trying, hard, to find a way to resist credentialism. A meritocracy is
something I want to live in.

Look, the reason I'm writing this comment is because my friend just gave up on
open sourcing their amazing project. Why? Because incentives. I've been trying
to convince him to MIT the code, but I can't say I blame him for keeping it
closed. And part of the reason is that the only people who get paid for
writing open source side project software are those high-profile genius types
that we're lauding on HN.

Credentialism. Reputation. Audience. These are harmful to a meritocracy. If
you've made something good, no one should give a damn who you are or how many
people like you.

~~~
mwfunk
The concept of reputation is harmful to a meritocracy? I don't agree with this
at all. Your friend didn't want to open source his project because he was
annoyed that he wasn't a famous hacker type who can get free publicity, so he
didn't think he would get paid to work on it? That's not how this works.
That's not how any of this works.

Nobody gets torn to shreds on HN for showing people their project, people get
torn to shreds for trying to use open source and HN as a cynical self-
marketing tool, especially when they can't back it up with something cool and
interesting. Open source doesn't exist to further the career or finances or
reputations of open source authors, it's just a nice little miracle when it
does.

If someone makes something great, there's a teeny tiny chance it'll catch on
to become widely used, and if that happens there's an even teenier, tinier
chance that the creator will at some point get paid to work on it, but that's
a tiny sliver of the open source world. If that's all your friend cares about,
then the meritocracy is real and working. Someone who will only write open
source to become rich and famous is clearly deeply confused about how and why
any of this stuff exists in the first place, and until they grow up they can't
be relied on to do good work for good reasons.

However, there's a silver lining. If instead of becoming the next Linus,
someone simply wants to steer their career towards working on open source
professionally, that's awesome and commendable. There are lots of companies
and government agencies and so on that pay people to work on open source
projects as their day-to-day job. That doesn't take social capital or name
recognition, that just requires getting a job in one of those organizations,
which span the gamut from tiny startups, to giant companies like
Google/Apple/Microsoft/etc., to government agencies like NASA. Tons of people
get paid to work on open source if that's what your friend cares about.

~~~
shawn
What if you want to work for yourself? What if you want to start a startup?
What incentives do you have to open source your software?

We all rely on open source tools, but lately they're coming _exclusively_ from
large companies that can afford to develop it. And that should worry us. It
means we're losing the control we used to have.

In a scientific paper, the related work section doesn't present the past work
of the authors, unless it's related to the topic at hand. There's a reason
Ballard didn't mention himself (beyond signing the page at the bottom).

~~~
Benjamin_Dobell
> We all rely on open source tools, but lately they're coming exclusively from
> large companies that can afford to develop it.

Do you have any evidence to support this?

In the age of GitHub and social coding I would have thought that open source
is more individuals, and less corporate (percentage-wise) than ever before.

P.S. I work for my self and open source a fair bit. I tend to open source
libraries rather than products, which is true for most companies. Facebook
open source React, not Facebook.

------
okket
Previous discussion from 4 years ago:
[https://news.ycombinator.com/item?id=8704629](https://news.ycombinator.com/item?id=8704629)
(328 comments)

Discussion about the specification from 3 years ago:
[https://news.ycombinator.com/item?id=10604465](https://news.ycombinator.com/item?id=10604465)
(32 comments)

~~~
benjaminl
What has happened since those previous discussions is that HEIF is begining to
get traction. Apple has adopted HEIF for it's latest OSes (iOS 11 or macOS
High Sierra)[0] and Android P is adding support for it.

HEIF is a standards based based MPEG image format that like BPG is based on
HEVC. Due to HEIF being an MPEG standard and the traction it is getting in the
marketplace it looks like we might finally have a true next gen format to
replace JPEG.

None of this takes away anything from BPG. I just thought is was curious that
given HEIF is the obvious elephant in the room, the linked page didn't mention
HEIF and indeed until now, no other comment has mentioned it.

[0] - [https://support.apple.com/en-us/HT207022](https://support.apple.com/en-
us/HT207022)

~~~
zamadatix
Windows 10 added support for HEIF in 1803 as well.

Another one to keep an eye on in the near future is AVIF which is AV1 in a
HEIF container as standardized by the AOMedia. With so many big players being
behind AV1 it'll be interesting to see if it can gain user traction faster
than HEIF.

~~~
jws
_…gain user traction faster than HEIF._

In less than one year from introduction, about a half billion iOS 11 users†
are using it as their default photo format. Not bad for traction.

Of course it wasn't their decision, it just sort of happened.

␄

† I must confess I made up this number. >80% of iOS users are using iOS 11,
last year there were 700M iPhones, there are some iPads too, and some Macs,
though not all iOS hardware can do HEIF. Let's just say I'm probably within a
factor two.

~~~
askvictor
And every time my technically-challenged colleagues want to get photos from
their iPhone onto a computer or web service, they can't do it, and don't know
why their iPhone's camera is broken and why they feel so stupid with all of
this technology.

~~~
Razengan
Conversion to JPEG for destinations that don’t support HEIF is automatic
unless opted-out, like this screenshot I just took and uploaded from my
iPhone:

[https://i.imgur.com/SUeHuIO.jpg](https://i.imgur.com/SUeHuIO.jpg)

~~~
askvictor
The case in question is of a person who plugs his iPhone into a PC, where it
appears like a camera (PTP mode?); they transfer as HEIF.

------
walrus01
Sadly I don't think this will find its way into any major commercial products,
because using H264/H265 and HEVC stuff in many US and Western European
countries, and not paying for a patent license on a per-unit basis, is a
guaranteed way to get yourself sued by some pretty big companies.

Something AV1 based for still image might find more widespread use.

[https://en.wikipedia.org/wiki/AV1](https://en.wikipedia.org/wiki/AV1)

~~~
bhaavan
Yes! I would have bet AVIF would have been the container format of the future.
Hopefully though, it can take some learnings out of this project and become
even better at the end given evolution is metadata storage expectations to
support "live photos" "motion photos" etc. But having another format when
there are already so many, may result in unwanted confusion too, which I would
be wary of. :(

------
unicornporn
Wouldn't the AV1 Image Format be a much better option as "the next image
format for the web"? Better compression than HEIC and the licencing issue
seems much clearer.

[https://www.techpowerup.com/240863/google-and-mozilla-
push-f...](https://www.techpowerup.com/240863/google-and-mozilla-push-for-
av1-image-format-adoption-beats-jpeg-and-heic)

------
xori
Results look nice, but it seems to only excel at solid colours and gradients,
anything with detail is smoothed out. Which admittedly looks nicer than the
classic jpg artifacts.

[http://xooyoozoo.github.io/yolo-octo-bugfixes/#abandoned-
fac...](http://xooyoozoo.github.io/yolo-octo-bugfixes/#abandoned-
factory&jpg=s&bpg=s)

I think the above link shows it best. Not only does the jpg get better details
in the middle walls and broken windows, but it's also smaller. But the BPG
gets the blue sky gradient without banding and artifacts.

~~~
mark-r
Thanks for the link.

Are you sure the details you're seeing in the jpg aren't just artifacts?
There's only one thing I see in the middle wall that I am confident is
supposed to be there in the jpg.

The nature of lossy compression is that you need to decide where the losses
will be. I think BPG is making the right choices.

------
bufferoverflow
Looks great, but, unfortunately, it's not supported by any browser:

[https://caniuse.com/#search=bpg](https://caniuse.com/#search=bpg)

~~~
sddfd
File a bug :)

~~~
masklinn
It's unlikely they'll care: browsers which don't want to deal with HEVC
licensing aren't going to touch it (likely preferring AVIF), and browsers
which are fine with HEVC licensing support the conceptually similar HEIC.

~~~
pmoriarty
Could someone expand on this?

What are HEVC, AVIF, and HEIC licensing and why are browsers partial to some
over the others?

~~~
ksec
HEIC is based on HEVC ( H.265 ), and therefore requires licensing and paying
royalty before using it, most likely paid by Microsoft (Windows), Apple or any
of your hardware manufacture. It could cost up to ( capped ) $100M per year
for hardware manufacture. HEVC Advance Group has made software decoding
royalty free. But you still have to paid MPEG Licensing and Velos Media.
Because Apple and Microsoft likely has cross patent arrangement to most of the
companies within the group, so it wouldn't matter much to them. But for
everyone else, HEVC licensing is still a bag of hurt.

AVIF is based on AV1, by Open Media Alliance lead by Google, is royalty free.
( But not patent free, please don't mixed this up ) It is new and the spec has
only been released for no more then 6 weeks. Google doesn't want to pay the
licensing, especially when the initial licensing terms for HEVC include cost
per streaming. All of Youtube video requires VP9 ( the predecessor of AV1 )
for 2K+ resolution, and does not and likely will not ever include HEVC.

Chrome does not support HEVC decoding even if you have hardware decoding. The
same for Firefox. That is why the parent said BPG won't ever be included in
browser, or Chrome and Firefox. M$ IE 11 / Edge and Safari both support HEVC.

------
ransom1538
At work we use an aws lambda job to push all uploaded images into BPG format.
It's a damn nice format. Works with mobile perfectly: light weight and renders
pretty quick.

------
labster
Not to be confused with BGP image format:

[https://news.ycombinator.com/item?id=14621347](https://news.ycombinator.com/item?id=14621347)

------
microcolonel
It's beginning to look like AVIF is more likely to gain deployment than BPG.

------
pedalpete
Looking at the examples [http://xooyoozoo.github.io/yolo-octo-bugfixes/#zoo-
bird-head...](http://xooyoozoo.github.io/yolo-octo-bugfixes/#zoo-bird-
head&jpg=l&bpg=l)

Comparing large size to large size, the difference in resolution (to me) seems
minor. The difference in filesize is 2kb, but it takes 56kb javascript to add
browser support.

Can somebody explain what I'm not understanding about the benefits here?

~~~
bgirard
You'd only ship the library to polyfill for legacy browsers that don't support
the format and don't have more efficient native decoders. This is an
alternative to having an image pipeline where you encode your images in
multiple format or if you have sufficient images to make up the 56kb initial
download and are willing to comprise on the initial load.

It's also a good way to start deploying the technologies before it receives
full adoption.

------
dahart
> images with alpha channel

I’ve read about BPG before, but not sure I noticed alpha support. This is
intriguing! I’m a bit curious: what are the use cases for a lossy image with
an alpha channel? BPG doesn’t have a lossless mode, does it? Games maybe?

And I love that it has both pre-multiplied and un-pre-multiplied storage.
PNG’s un-pre-multiplied only is what prevents adoption of PNG for so many
alpha related workflows.

~~~
adsche
> BPG doesn’t have a lossless mode, does it?

Acording to the linked site: "Lossless compression is supported."

~~~
ehsankia
Most modern formats have both alpha and animation, support lossless and lossy,
all while still getting better performance and compression than jpg/png. And
even then, when it comes to replacing the old formats, it's still an uphill
battle.

------
shmerl
_> Based on a subset of the HEVC open video compression standard_

Is it patent encumbered then? And can it replace JPEG in such case?

~~~
stefan_
Very much so. It is very deceiving to have a lengthy discussion on licenses
and not mention that using this on a public-facing website without a
comprehensive _patent_ license in place is going to get you sued.

~~~
shmerl
So it's nowhere a JPEG replacement then in practical terms. Something based on
Daala or AV1 would make more sense.

~~~
MaxBarraclough
We already have FLIF.

My understanding is that it's biggest problem is decode speed.

------
childintime
Apparently this is quite old (2012), see: [https://irfanview-
forum.de/showthread.php?t=10291&s=cb7ce1c4...](https://irfanview-
forum.de/showthread.php?t=10291&s=cb7ce1c46108ace2b02ee89ed1211e5b)

------
tonetheman
And while such a claim from a random would be dubious at best. Fabrice is a
prolific genius. Look at this list of stuff on his main site:
[https://bellard.org/](https://bellard.org/)

~~~
21
Why would it be dubious that one of the newest and most advanced video codecs
has a highly efficient keyframe encoding which beats 20 years old tech?

~~~
ben0x539
Because of the standard "if this was so great, I'd have heard of it already"
razor.

~~~
blattimwind
I don't think this is the first still-image application of HEVC; it's just
that HEVC is a patent-licensing pit.

Also JPEG was 1990 iirc so it's closer to 30 years old by now.

------
LukeB42
Not enough comparison to PNG. Source indicates borrowing heavily from PNG
though. Am I missing something here about a relation / coevolution between
these formats?

------
skrowl
How does it compare to WebP & HEIF(both in performance and acceptance in
modern browsers / etc), which seem very similar?

~~~
pornel
Half size of WebP. WebP is based on an otherwise obsolete codec that's 2-3
generations behind latest codecs.

Similar compression to HEIF, but it's a _much_ simpler container.

~~~
skrowl
Looks like Mozilla's last word on it is that they won't add it:

[https://bugzilla.mozilla.org/show_bug.cgi?id=1111277](https://bugzilla.mozilla.org/show_bug.cgi?id=1111277)

> Thomas Daede [:TD-Linux]

> Comment 13 • 3 years ago

> The licensing costs for HEVC makes implementing BPG in Firefox impractical.

> In addition, supporting a patent encumbered image format is not in line with
> Mozilla's goals of promoting the free and open web.

> BPG's technical performance is impressive, but a successor to JPEG needs to
> not regress on the freedom of usage that JPEG offers.

------
atern
Why? What's wrong with FLIF?

~~~
MaxBarraclough
Exactly what I was thinking. Surprised to see no mention of FLIF in the
article. It's nothing new to do better than PNG and JPEG.

It's HEVC-based, so it might be able to outperform FLIF for in-browser
decoding speed.

------
sddfd
What's the license?

~~~
wolf550e
The copyright on the code is not the problem, HEVC/H.265 patents are the
problem.

------
jeswin
I came here hoping the discussion would be around BPG and not Bellard - not
happening. HNers act like Bieber fans when it comes to Bellard. Even they have
moved on.

------
guitarbill
Given that most optimisers strip metadata, and metadata can also lead to bad
SecOps fails, wouldn't it be better to simply not support metadata in a new
image format? Do ICC profiles on images even work properly?

~~~
matt4077
I believe consensus among the general population is to no longer support
people using terms such as "SecOps fails".

They did actually try to get the ICC (International Criminal Court) involved.
But the judges demurred, citing an obscure software patent from 2002 and
suggesting The Hague's War Crimes Tribunal as a better venue.

