Rethink default channel naming, just use R, G, B, A.#1434
Rethink default channel naming, just use R, G, B, A.#1434lgritz merged 1 commit intoAcademySoftwareFoundation:masterfrom
Conversation
|
How about |
|
In other words -- I think the main case to fix is 1 channel images (alpha alone doesn't make sense for sure). I don't think I've ever seen a 2 channel image in the wild - so maybe |
|
As somebody pointed out on the oiio-dev side of this conversation, OpenEXR's DWA compressions actually care about the channel names and only apply the lossy compression to certain named channels. Y would work, but I think L would not. I agree that 2 channel images are extremely rare, if not virtually extinct in the wild, so maybe it's not worth overthinking that case or forcing it to be consistent with the 1-channel case, punt and go with R, G. So the leading contenders for one-channel are R and Y. My best argument for R is that it makes the logic for n channels totally consistent, no special cases for 1-channel. My best argument for Y is that a one-channel file is almost certainly intended to be grayscale intensity, not "red" per se, and "Y" is already commonly a channel name for grayscale intensity (HSY, YIQ, YCrCb, etc.). |
|
|
|
OK, I'll revise this PR. After sleeping on it, I also like Y better than R for single channel. I'll keep R,G for the rare 2-channel case, because I just don't think there's a better choice. This PR is just about choosing the default channel names for formats that lack channel names in the file. There are some other channel name-related issues that I'll tackle in separate PRs. |
|
Updated patch to use name "Y" for the special case of a single channel in the file. |
|
Second version LGTM |
|
LGTM2 |
…nnel) 1-channel images (from formats without channel naming) get Y. 2+ channel images get R, G, B, A, channel4, channel5, ... Before, we were setting the default names to "A" for 1-channel and "I","A" for 2-channel. Which is bad because "A" means alpha, and some operations treat alpha as special (such as PNG output dividing all the non-alpha channels by the alpha value!). This is just for formats that don't actually store channel names in the files. Which is most formats.
In particular, 1-channel images (from formats without channel naming) will now get R, 2-channel images get R, G.
It's not perfect, because it's probably not really "red" and "green." But before, we were setting the default names to "A" and "I","A". Which is probably much much worse, because "A" means alpha, and lots of operations treat alpha as special (such as PNG output dividing all the non-alpha channels by the alpha value!).
This is just for formats that don't actually store channel names in the files. Which is most formats.