SUMMARY While alpha inheritance merging using layer->flatten image now works, it doesn't work with document.flatten(). STEPS TO REPRODUCE Run this python script, open a file with alpha ineheritance in its layer stack: ------------------------------------------ from krita import * from PyQt5.QtWidgets import QFileDialog # Open a file, flatten it, add a view to the krita instance. filename = QFileDialog.getOpenFileName(caption="Open File", filter="Krita files (*.kra)")[0] doc = Application.openDocument(filename) doc.waitForDone() # Now we'll add a new view. Application.activeWindow().addView(doc) # Now we'll flatten doc.flatten() doc.waitForDone() ------------------------------------------ OBSERVED RESULT Everything is blank EXPECTED RESULT Image, but flattened to a single layer.
Works for me... could you please include a file that gives you that behaviour? I'll checked with my test files for similar problems and they all worked. (In the previous issue like that: BUG 405119 the problem was when the layer inside of the group was selected, nothing special about alpha inheritance; so in this case, I checked saving my test files with different layers selected and none gave me the issue, that's why I need exactly the same file that gives you issues to make sure the same layer is selected and located in the same combination of layers and groups).
Created attachment 118771 [details] File to open with the script. This file reproduces the bug with Krita Version: 4.2.0-pre-alpha (git 52ee93a) on KDE Neon.
Confirmed. The only thing is, alpha inheritance probably doesn't matter that much. If you disable alpha inheritance in the image and save and try to flatten with the provided python script, the result is incorrect, too. Also, since the test image has non-transparent background color, the result is also incorrect because of bug 405684 . It's unrelated to the missing content problem here, though.
Can you please check whether it works for you now on master? It looks to me like it was fixed by c7a921d1b7b5e6a. Also (in case the future proves it needs more investigation) if you tried even before the commit mentioned to first open an image (in one script) and then flatten the image (in another script), it worked. The projection of the layers were not updated for some reason if you tried to flatten just after opening.
Fixed