Bug 405684

Summary: Flatten image with canvas background color gives non-transparent background in result
Product: [Applications] krita Reporter: Tiar <tamtamy.tymona>
Component: Layer StackAssignee: Tiar <tamtamy.tymona>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Example test file

Description Tiar 2019-03-20 13:14:03 UTC
Created attachment 118935 [details]
Example test file

SUMMARY
Background color is not saved in the image while flattening. This results in a wrong results if the background color is not purely transparent.


STEPS TO REPRODUCE
1. Open file with opaque background color. Example file attached.
2. Flatten using Layer -> Flatten Image.

OBSERVED RESULT
3a. The result looks the same as expected, however if you hide the only layer, you'll see transparency grid... which means parts that were transparent before were changed to the color of the previously selected background color.
4a. If you go to Image -> Properties, you'll see Background color set as black, 0% opacity, no matter what was the previous background color.

EXPECTED RESULT
3b. The result looks the same, but the previously transparent parts are still transparent; transparency just look like a solid color, according to the settings chosen in Image -> Properties.
4b. The same color is set in Image -> Properties before and after flattening.

NOTES:
- if you undo flattening while having the new layer visible, the undo will be correct, including the correct background color. If you however undo flattening when the layer is hidden, you'll get all of your previous layers correct, but the background color will be set to transparent.
- if you flatten image with transparent background color, but the value of the color will be different from black, after flattening the result will be correct, but the background color will be set to black, 0% opacity.
- test file was taken from bug 405366 , just renamed.

SOFTWARE/OS VERSIONS
Krita

 Version: 4.2.0-pre-alpha (git fbba406)
 Languages: pl
 Hidpi: false

Qt

  Version (compiled): 5.11.3
  Version (loaded): 5.11.3

OS Information

  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 4.15.0-45-generic
  Pretty Productname: Linux Mint 19.1
  Product Type: linuxmint
  Product Version: 19.1


Hardware Information

  GPU Acceleration: auto
  Memory: 7771 Mb
  Number of Cores: 4
  Swap Location: /tmp

ADDITIONAL INFORMATION
Git hash: fbba406b15d7f6b066fd40
Comment 1 Tiar 2019-03-22 18:13:49 UTC
This commit changes only the canvas color after the flattening: now it is the same as before the flattening.

The change of behaviour of canvas color during flattening requires a discussion.

-----

Git commit ad1f27076d5df97326f9b07eb70bd93e75902d1b by Agata Cacko.
Committed on 22/03/2019 at 15:47.
Pushed by tymond into branch 'master'.

Fix Background Color change after flattening

Before this commit if you flatten the image using
Layer -> Flatten Image, the resulting image
had canvas background color set to transparent black.
Now the resulting image has the same canvas color
as before the flattening.

M  +1    -3    libs/image/kis_image.cc

https://commits.kde.org/krita/ad1f27076d5df97326f9b07eb70bd93e75902d1b