-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
Do we have to test in C++? The test suite for Native runs in JS after all. |
Yes, we don't want to write node bindings for every internal thing we test. |
Ok, pixelmatch is ported and in use. Tests are passing locally by failing on CI. I think it's something to do with PNG color profiles? Here's a sample failure. When I run the JS version of pixelmatch locally on those files, it reports they are identical. @mourner Have you encountered this? |
Color profiles seems likely. |
6fdf3d2
to
a5d1b9a
Compare
* Consolidate Image and StillImage * Typecheck unassociated vs premultiplied images * Rewrite default platform image decoding implementation
It appears to be the only way to get the results we want in all cases.
It's a premultiplied image. This implies that we were misusing encodePNG in most cases, as we were passing premultiplied pixels which were then interpreted as unmultiplied. I changed encodePNG to accept premultipled pixels, and unpremultiply in the implementations.
a5d1b9a
to
1d33790
Compare
@jfirebaugh what was it? Haven't encountered anything similar on JS side. |
It was undesired premultiplication behavior of libpng when a color profile is present in the source PNG, plus confusion in our code about where image data is premultiplied and where is is not. To fix the first, I disabled all premultiplication in libpng and manually premultiply using an algorithm that is reversed engineered to produce the same results as Core Graphics (premultiplication algorithms are surprisingly subtle). To fix the second, I rewrote most imaging code to work with explicit |
The annotation tests currently require manual verification. Predictably, they regressed without me noticing (my fault).
We need to:
pixelmatch-cpp
?) /cc @mourner