I\'ve found that I\'m getting different RGB when using Java (& actually paint.NET) than I am using ImageMagick, Gimp, Python, and Octave. The last 4 all agreeing with ea
As per my comment, the major difference between the various applications/libraries that you've used to retrieve pixel colour value is that they're all using different versions of libjpeg - at least on Mac OSX.
When you check out your Github project onto certain versions of Ubuntu you'll see that all values are reported the same across the board. In these cases, python ImageMagick and the Java JDK/JRE are using the same libjpeg implementation.
On the Mac, if you installed jpeg
via homebrew
, or Pillow
via pip
then you'll notice that they're using libjpeg v9 (libjpeg.9.dylib
), whereas Java 7 and 8 JDKs come with their own libjpeg bundled that are quite different.
Octave lists its jpeg dependencies as libjpeg8-dev
.
GIMP, Inkscape, Scribus etc also come bundled with their own. In my case, GIMP comes bundled with the same version as python and ImageMagick, which would explain the similar values (ie: /Applications/GIMP.app/Contents/Resources/lib/libjpeg.9.dylib
)
If you want to guarantee the values being the same across apps, you have options:
libjpeg.9.dylib
and use that from your Java app. I'm not 100% sure how you'd do that though.I'll admit that options 2 and 3 are really harder versions of option 1!
Note:
I'm definitely up-voting @haraldk's answer because his conclusion is pretty much the same.
I also played with using different icc profiles, and they give totally different answers. So it's worth being wary of that.
I just wanted to add an answer that added more emphasis on the libjpeg implementation, because I believe that is what is catching you out in your specific instance.
Actually, there is another major difference noted in @haraldk's answer, being the diff between CMM and Little CMS. As he says: Java uses Little CMS, which is also used by Ubuntu
I actually think that's more likely to be the answer here.