Summary: | Split-alpha on 16-bit EXR images destroys alpha channel (needs high bitdepth selections) | ||
---|---|---|---|
Product: | [Applications] krita | Reporter: | João Queiroz e Lima <joao.queiroz.lima> |
Component: | File formats | Assignee: | Krita Bugs <krita-bugs-null> |
Status: | CONFIRMED --- | ||
Severity: | wishlist | CC: | dimula73, halla, joao.queiroz.lima |
Priority: | NOR | ||
Version First Reported In: | 2.9.8 | ||
Target Milestone: | --- | ||
Platform: | Microsoft Windows | ||
OS: | Microsoft Windows | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
João Queiroz e Lima
2015-09-17 11:42:49 UTC
Hm, but this image has pixels with zero alpha channel and non-zero color channels. That's a problem in itself, which is why you get a warning when loading the image. There are several issues possible: 1) The image has zero alpha + non-zero color pixels. We artificially raise the alpha value to allow premultiplication. 2) The image has tiny non-zero alpha + non-zero color pixels, but division is possible without overflow of color channels. Then we must not change anything. 3) The image has tiny non-zero alpha + non-zero color pixels, but division is not possible due to a half overflow. In this case we must also raise alpha a bit (as in case 1) ) to allow correct rendering of the image. See https://bugs.kde.org/show_bug.cgi?id=301443 for more information. I'm not sure whether this is actually fixable in Krita at this moment, I need to discuss it with Dmitry, who is on vacation at the moment. Hi Boidewijn, I'm sorry for the late reply. I was trying to follow on everything you say on your post and I presume that alpha zero means fully transparent pixel. I also understand, by premultiplied, that the image has info for RGBA in each pixel and that is what Krita does not support. Am I right on those two assertions? If so, with the info the image I sent provides, would it be possible to make Krita distribute the RGB values to a paint layer and use the alpha values to build a transparency mask assigned to that layer? I'm sorry, I want to contribute to solving the problem, but I'm afraid I can't understand everything you said... Sorry for mispelling Boudewijn... Any news on this issue Boudewijn? Thanks for fixing multilayer EXR! However I've noticed that EXR RGBa isn't yet fixed for single layered images. I don't understand why this is behaving differently than what's supposed but I'm sharing 4 files in a folder: https://app.box.com/s/ew5uo4vykxmu16tbu1l1s87llsypcc9f [b]FILE 1 "01 RGBa Test.exr"[/b] - The test file wich has 4 channels (RGB + Alpha) for you to import into Krita. The first thing you'll notice is, of course, the dialog below. The result is that background colors disappear. What I'd like for you to test is to split alpha on the existing layer by right clicking on it. RGB info is gone as soon as you split alpha. Dialog: https://app.box.com/s/03adxdb5zu54w8wmmln3okc7w5ybbjzp [b]FILE 2 "02 RGBa Test.png "[/b]- A test file for you to compare what is happening with another file with the same 4 channels (RGB + Alpha). Try the same thing: Import into Krita and split alpha like above. The result is what you'd expect. Transparency mask is created but the background colors are still there. RGB info isn't disturbed when you split alpha. This is what should happen with EXR too. [b]FILE 3 "03 RGBa Test EXR Its Importing Like This.kra"[/b] - This shows the result of the process described for [b]FILE 1[/b] [b]FILE 4 "04 RGBa Test EXR Should Import Like this.kra"[/b] - This file shows what should happen when using the process from [b]FILE 1[/b] [b]FILE 5 "05 RGBa Multilayer Alpha Test.exr"[/b] - Was created from the same renderer (Thea) but alpha channel was rendered along with other channels (Color, Alpha, Material ID, Reflection, Refraction, Shadow). It was then saved as a Multilayer EXR. In this file, alpha is being interpreted as a separated channel. This was the base file I used to produce "FILE 4". What I did was: a) Import the multilayered EXR wich is now working flawlessly [i][u][b](Thanks!)[/b][/u][/i]; :D b) Converted Alpha channel into a transparency mask attached to the first layer (RGB); c) Erased all other channels. What I find interesting is that dialog that shows up saying that a colored pixel cannot have 0 alpha? Why is that? It is allowed with PNG as shown with "FILE 2", why can't the EXR in "FILE 1" behave the same? I'll relate this BUG with the original post hoping you won't mind. Thanks for all the attention and effort put into this. Best regards, João I think I might have to add a dialog that allows the user to add interpretative hints for the layers... It's pretty hard to figure out what something should look like from the file, it depends too much on the app that generates the exr. I can reproduce this bug on CandleGlass.exr. I'll check what we can do with it Okay, the problem happens because all the selections in Krita are 8-bit. Therefore one cannot split alpha from a 16-bit EXR image without precision loss. I don't think it is fixable without implementing high-bitdepth selections. I will downgrade this bug to a wishlist, because it needs high bitdepth selections, which is not in our roadmap currently. Perhaps we should provide some other algorithm for working with alpha channel in high bitdepth images. |