4 ms·
Also watch this please if you ever do plots using colormaps: https://youtu.be/xAoljeRJ3lU https://youtu.be/xAoljeRJ3lU About the perceptual uniform, colorblind
by maxnoe 7y ago
Also watch this please if you ever do plots using colormaps:
https://youtu.be/xAoljeRJ3lU https://youtu.be/xAoljeRJ3lU
About the perceptual uniform, colorblind friendly colormaps in matplotlib since 1.5.
Now also adapted by most other plotting tools.
- quietbritishjim 7y agoIf we're on the "watch this YouTube video if you work with colours" train, here's a great explanation of why gradients usually have a dark band in the middle, on the MinutePhysics channel: https://youtu.be/LKnqECcg6Gw https://youtu.be/LKnqECcg6Gw In short: the RBG values in an image are not actually the intensity of light, but some nonlinear function of intensity. To do a weighted average of two colours you need to first undo that nonlinearity, then do the averaging, then reapply the function. Most software doesn't do that so the colours end up wrong. This also applies to resizing images.
- marcan_42 7y agoIt irks me to no end that in 2020 we are still using outright incorrect math for image processing, practically everywhere, with visible consequences (another one: this can also be blamed for a good chunk of the moiré artifacts when resizing images containing patterns, it's not just about subpar filters). Ironically, Photoshop does this wrong by default, but the open source GIMP does it correctly (in current versions).
- mantap 7y agoPretty much the first thing you learn in game development (OK not the first thing), is the difference between linear-RGB and sRGB and the need to do lighting calculations in linear space in your shaders. It's crazy that professional graphics software doesn't get this right.
- martin_a 7y ago> It's crazy that professional graphics software doesn't get this right. "Professional graphics software" does what it's supposed to be and sRGB is an inferior standard in most use-cases of that software. Its gamut is simply not large enough, but it's a nice smallest-possible commond ground.
- marcan_42 7y agoThis isn't a gamut problem, it's a bad coding problem. "Professional graphics software" (i.e. Photoshop) absolutely does the wrong thing for color blending with the default settings. It's not a problem of being limited to the sRGB color space, it's about the math in use being outright wrong for use on that color space. You need to go into the settings and tick some checkbox to have some hope of it doing the right thing ("Blend RGB colors using gamma"), and even then I bet it only applies to some operations like blending itself, not scaling and other filters. This is because all non-linear image encoding modes, like sRGB or straight gamma, should be viewed as compression. You don't perform mathematical operations on compressed data. It's like trying to mix together two MP3 files by literally taking the bytes and averaging them out. That's madness and does not work. You need to go into a linear format, like raw PCM, to be able to do that (with the right word size). Same with images: you need to convert from sRGB to linear light to be able to do math on them. But 95% of software, including "pro" software, doesn't do this, it just blindly does math on compressed (gamma encoded) data, and the result is ugly (we're just used to it). Of couse, with Photoshop you can set your image mode to linear light and then things work fine... but that's not because linear light is required to make this stuff work, it's because Photoshop is broken when not using linear light and doesn't compensate for the encoding. Meanwhile GIMP, a few versions ago, fixed this whole mess and actually applies blending and filtering in linear light (regardless of what mode your image is using in memory), making its blending and filtering much more pleasant and correct than Photoshop's. So yeah, it may not support CMYK or other "pro" features... but for a good chunk of basic editing in RGB space, you're actually going to get more correct and visually appealing results if you use GIMP than Photoshop.
- mrob 7y agoResizing in sRGB has the advantage of obscuring ringing artifacts when enlarging images, because the nonlinearity puts more of them in the highlights than the shadows, where they're less obvious to human vision. You can get perceptually even better results when enlarging by using a sigmoidized colorspace. See: https://www.imagemagick.org/Usage/filter/nicolas/ https://www.imagemagick.org/Usage/filter/nicolas/ For another clear example of the problems of resizing in linear colorspace, see "Catch #3" here: https://entropymine.com/imageworsener/gamma/ https://entropymine.com/imageworsener/gamma/
- donatj 7y agoInteresting - I have a tool using CIEDE2000 to calculate color differences - I learned from this that I should probably be using CIECAM02? I'll need to investigate further, but this was a very interesting watch regardless.
- anderspitman 7y agoColorBrewer[0] is a great research-backed resource for dataviz colors. [0] http://colorbrewer2.org/#type=sequential&scheme=BuGn&n=3 http://colorbrewer2.org/#type=sequential&scheme=BuGn&n=3